serverless-with-next5-boilerplate
serverless-with-next5-boilerplate copied to clipboard
Known issue: Serverless `staging` path rewrites messing with links
On AWS, I can't get Next.js to work correctly because of the Serverless staging
path rewrite:
The main page (https://11lwiykejg.execute-api.us-east-1.amazonaws.com/development/
) works fine, but:
- when clicking on a "Page 2" link, it goes to the wrong URL:
https://11lwiykejg.execute-api.us-east-1.amazonaws.com/page2
, it's missing the/development
part and the browser will display{"message":"Forbidden"}
-
Current workaround: I used a custom domain, it fixes the missing
development
part (by removing thestaging
part of the url entirely, which fixes the issue): - https://swn.dev.vadorequest.fr - https://swn.dev.vadorequest.fr/page2
A solution that doesn't rely on Custom Domain would be interesting and useful when doing tests against AWS without providing a custom domain (which isn't trivial to do, since it requires to own a domain)