Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amplify Console redirects to wrong url when trailing slash required #405

Closed
idrisov-ri opened this issue Feb 4, 2020 · 13 comments
Closed
Labels
archived This issue has been locked. bug Something isn't working pending-prioritization Added to the backlog. Pending prioritization.
Projects

Comments

@idrisov-ri
Copy link

idrisov-ri commented Feb 4, 2020

Not sure this is right place for my question.

From AWS Amplify documentation:

The Amplify Console automatically creates clean URLs by adding a trailing slash when required. The table below highlights different scenarios:

User inputs in browser URL in the address bar Document served
/about /about /about.html
/about (when about.html returns 404) /about/ /about/index.html
/about/ /about/ /about/index.html

In App we are working at now the second scenario is not true.

When user inputs /about (no trailing slash in the end)and needed to be redirected to /about/(have trailing slash in the end), instead he is being redirected to a url similar to something like /0000000030/about/. Where the 0000000030 part of the url seems to be a Build ID of AWS Amplify App.
This url not exists so user get 403 response status with AccessDenied XML error message.

My question is, is it desired behavior or is it a bug?
If it is a bug what can we do to make it work as desired?(/about, is rediricted to /about/, not to/0000000030/about/)

By the way, there are no Rewrite or Redirect rules set up in our Amplify Console App.

thanks in advance!

@idrisov-ri idrisov-ri changed the title Amplify Console redirects to wrong url when trailing slash needed Amplify Console redirects to wrong url when trailing slash required Feb 4, 2020
@swaminator swaminator added the bug Something isn't working label Feb 4, 2020
@ihao8
Copy link
Contributor

ihao8 commented Feb 11, 2020

Hi @idrisov-ri we cut a ticket in our customer oncall backlog, will investigate your issue later. Thank you for understanding.

@ihao8
Copy link
Contributor

ihao8 commented Apr 9, 2020

Hi @idrisov-ri , Thank you for reporting. I cut a ticket in our team backlog. We will working on investigating a fix!

@ihao8 ihao8 added the pending-prioritization Added to the backlog. Pending prioritization. label Apr 9, 2020
@j-yamamoto
Copy link

@Joycehao19 +1 for this problem to be fixed. Btw, is there any workarounds to redirect url without trailing slash to one with trailing slash?

@eganondorf
Copy link

I add myself to this problem, but for me the problem is as follows:
If I navigate to my application via the base URL https://<app_url>, perform the login, navigate through my menus, everything works fine.

But if for some reason I refresh, either by pressing F5 or pressing the icon on the browser, then I get the https://<app_url>/<build_#>/<path_I_was_on> instead of a simple reload to https://<app_url>/<path_I_was_on>

I do have a single redirect setup due to my app being a SPA build on VueJS:
[ { "source": "/<*>", "target": "/index.html", "status": "200", "condition": null } ]

My application id is d2a5vpuqb7f44i on us-east-1

@eganondorf
Copy link

I add myself to this problem, but for me the problem is as follows:
If I navigate to my application via the base URL https://<app_url>, perform the login, navigate through my menus, everything works fine.

But if for some reason I refresh, either by pressing F5 or pressing the icon on the browser, then I get the https://<app_url>/<build_#>/<path_I_was_on> instead of a simple reload to https://<app_url>/<path_I_was_on>

I do have a single redirect setup due to my app being a SPA build on VueJS:
[ { "source": "/<*>", "target": "/index.html", "status": "200", "condition": null } ]

My application id is d2a5vpuqb7f44i on us-east-1

Forget my initial reply, I just followed the info on https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html#redirects-for-single-page-web-apps-spa and now its redirecting correctly.

The only heads up is to copy paste the Regex using the Open text editor option after you clicked Edit on the Rewrites and redirects page, that way you are sure you didn't copy some undesired space.

@litwicki litwicki added this to To do in Bug Bash via automation Oct 29, 2020
@theelk801
Copy link

Hi, I'm also having this issue. Will there be a fix soon?

@theelk801
Copy link

Just to add some info, I've noticed that the problem doesn't happen on build previews, only on main deployments.

@hankyupark
Copy link

I add myself to this problem, but for me the problem is as follows:
If I navigate to my application via the base URL https://<app_url>, perform the login, navigate through my menus, everything works fine.
But if for some reason I refresh, either by pressing F5 or pressing the icon on the browser, then I get the https://<app_url>/<build_#>/<path_I_was_on> instead of a simple reload to https://<app_url>/<path_I_was_on>
I do have a single redirect setup due to my app being a SPA build on VueJS:
[ { "source": "/<*>", "target": "/index.html", "status": "200", "condition": null } ]
My application id is d2a5vpuqb7f44i on us-east-1

Forget my initial reply, I just followed the info on https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html#redirects-for-single-page-web-apps-spa and now its redirecting correctly.

The only heads up is to copy paste the Regex using the Open text editor option after you clicked Edit on the Rewrites and redirects page, that way you are sure you didn't copy some undesired space.

this works for me

@jasonrundell
Copy link

This has been open for a long time. When is this issue coming out of the backlog and being worked on?

@msmurgui
Copy link

Same issue here! Cannot accept url query params because of the trailing dash, it cleans everything on the query

@msmurgui
Copy link

Fixed it by changing my "Rewrites and Redirects" rules. The only one I left was this one:
[ { "source": "</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>", "target": "/", "status": "200", "condition": null } ]

@hsspain
Copy link

hsspain commented Feb 19, 2021

The issue with build numbers being appended to redirects has been resolved. I am closing out this issue, but please open a new one if anyone continues to have issues.

@github-actions
Copy link

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.

@github-actions github-actions bot added the archived This issue has been locked. label Oct 29, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. bug Something isn't working pending-prioritization Added to the backlog. Pending prioritization.
Projects
Development

No branches or pull requests

10 participants