Closed seankovacs closed 2 years ago
@chrisbonifacio I can re-produce it
Just create a route in pages/api/(yourroute).js
then in that route return res.status(200).send(req.headers.referer)
then create a page in pages/(yourpage).jsx
and in that do an axios.get('/api/(yourroute)');
in local you'll see the referer is the URL of that page you are on but if you do it after it goes through Amplify, it's undefined.
@RealDrewKlayman Thank you! I don't think this is an issue we can address in the js library, it seems to be due to how we host NextJS apps so I will transfer this issue over to the console team.
Hi, unfortunately, we don't support forwarding these headers to your target server (reverse proxy) from Amplify managed distribution at the moment. According to https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html#request-custom-headers-behavior, CloudFront removes some request headers while processing the request.
I'll mark this as a feature request: Custom request header
in our backlog, thanks for your understanding
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Before opening, please confirm:
JavaScript Framework
React, Next.js
Amplify APIs
Authentication, REST API, GraphQL API, DataStore
Amplify Categories
auth, storage, function, api
Environment information
Describe the bug
The request object returned from getServerSideProps context doesn't include the original request headers from the browser (namely
referer
,user-agent
).Expected behavior
Ideally SSR has the original browser request (headers at-least) at hand to make decisions.
Reproduction steps
referer
is dropped completely.Code Snippet
See above
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response