Comments (11)
The url there seems to be urlencoded. The framework itself does not do any url encoding, it simply returns the response body as a string: https://github.com/awslabs/aws-serverless-java-container/blob/master/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsProxyHttpServletResponseWriter.java#L42
Can you share some code on how the html is generated and returned? would be good to log some info along the way:
- When the html is generated
- Before the
AwsProxyResponse
is returned to API Gateway - What comes to the client
from aws-serverless-java-container.
Attached the HTML page (changed extension to .txt)
I have Spring Controller bean that returns the html
`
@RequestMapping("/places")
public String places() {
....
String url = "PlacesListPage"; // PlacesListPage.html is present under templates directory
return url;
}
`
Above controller is called through API gateway. Right now the HTML page is being displayed to client but URLs with in the page are encoded.
In another scenario I have redirection to external URL
`
@RequestMapping("/link")
public String link() {
....
String url = "redirect:<external URL>";
return url;
}
`
In this case on browser i see an encrypted URL and 404 message
Hope this helps to explain the issue more clear.
from aws-serverless-java-container.
Thanks @gmaruti. Just to confirm, if you start the spring app on your local machine the url is returned correctly?
Take a look at the answer here: http://stackoverflow.com/questions/14938344/thymeleaf-construct-url-with-variable
from aws-serverless-java-container.
Yes, it does work in local...
from aws-serverless-java-container.
Is there any chance I can get access to the demo app to replicate? I cannot find a place where the framework would be urlencoding something. The only place where we url encode is in the response here: https://github.com/awslabs/aws-serverless-java-container/blob/master/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsHttpServletResponse.java#L99
from aws-serverless-java-container.
never mind. I managed to replicate the issue. I will look into it and let you know.
from aws-serverless-java-container.
I located the issue in the LinkExpression
class. When processing the link, it returns a URL encoded expression if the response is not null:
return response != null?response.encodeURL(url):url;
I'll investigate this comparing how the embedded container in spring boot behaves.
from aws-serverless-java-container.
@gmaruti I have committed a fix to the servlet-improvements branch. This fixes the issue for me. If you can, clone the branch, mvn install in local, change your pom to use 0.5-SNAPSHOT and test if this fixes the issue for you.
from aws-serverless-java-container.
Thanks, I will check and let you know...
from aws-serverless-java-container.
@sapessi I tested the code and it worked for me too!!.. Thanks for quick fix.
from aws-serverless-java-container.
Nice. I will close this and merge
from aws-serverless-java-container.
Related Issues (20)
- Reinitialization of Spring context when using SnapStart HOT 3
- Spring Cloud Gateway throwing "hostname can't be null" based on my request only having headers and not multi-value headers HOT 4
- ServletContext: Servlet.getServletConfig() is null HOT 1
- Cannot invoke "org.springframework.web.servlet.DispatcherServlet.getServletContext()" because "servlet" is null HOT 4
- org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: No content to map due to end-of-input HOT 1
- org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: No content to map due to end-of-input HOT 8
- Cannot deserialize value of type `java.lang.String` from Object value HOT 3
- SpringDelegatingLambdaContainerHandler unable to respond with rendered templates HOT 10
- SpringDelegatingLambdaContainerHandler does not handle Headers correctly for FunctionUrls HOT 7
- Cookies not able to be deleted by setting max-age to 0 HOT 3
- com.amazonaws.serverless.exceptions.InvalidRequestEventException: The incoming event is not a valid request from Amazon API Gateway or an Application Load Balancer HOT 2
- 2.x release HOT 1
- AwsProxyResponse class is generating response JSON which is rejected by API gateway with Malformed error HOT 3
- Moved AwsProxyRequestBuilder into test package HOT 4
- How to handle spring security with springboot serverless HOT 2
- Null Pointer While Setting Filter Post Startup Lambda Handler HOT 2
- Spring boot 3 context initialization issue when using with a servlet application having webflux dependency for web client HOT 3
- Error with version 2.0.2 when multi-value header is active in alb HOT 6
- Springboot 2 Lambda Layer Support HOT 2
- Query parameter values not URL decoded when using HTTP API V2 Gateway with a RequestStreamHandler implementation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-serverless-java-container.