I am using AWS Amplify and cannot figure out how to configure my rewrite and redirects or routes.js to prevent trailing slashes from breaking my functionality.
When I run my code locally and try to visit localhost:3000/foo/bar/id
the page renders fine. When I deploy this same code through amplify and user clicks a button with an href, the browser gets a 302
and redirects the user to example.com/foo/bar/id/
, then because this page doesn't exist, the default Amplify redirect sends them to index.html
with a 404
I have tried adding the following to my react routes:
/foo/bar/:id
/foo/bar/:id/
and the following redirect rules in the AWS Amplify console:
/foo/bar/<id> | /foo/bar/<id> | 302
/foo/bar/<id>/ | /foo/bar/<id> | 302
but nothing is working. I am losing my mind here, any suggestions?