Amplify-console: Amplify Console redirects to wrong url when trailing slash required

Created on 4 Feb 2020  路  8Comments  路  Source: aws-amplify/amplify-console

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!

bug pending-prioritization

Most helpful comment

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

All 8 comments

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

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

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

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

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.

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

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

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

Was this page helpful?
0 / 5 - 0 ratings