aws-amplify / aws-amplify/amplify-hosting

Redirecting to non-clean URLs?

Open
#2,760 2 comments 2 reactions 0 assignees View on GitHub
question redirects
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

**Please describe which feature you have a question about?**

Rewrites/redirects that result in non-clean URLs.

I have failed to figure it out reading , and , and by browsing the issues here.

**Provide additional details**

I am trying to redirect to a site that does not use clean URLs, and so I want to transform the path from `//` or `/` to `/.html`.

**What AWS Services are you utilizing?**

AWS Amplify

**Provide additional details e.g. code snippets**

My current **Rewrites and redirects** configuration is:

```json
[
{
"source": "https://master.dhfqby5l2aw43.amplifyapp.com/2019/10/21/beta",
"target": "https://qa-backstage.forgerock.com/docs/sdks/latest/2019/10/21/beta.html",
"status": "301",
"condition": null
},
{
"source": "https://master.dhfqby5l2aw43.amplifyapp.com",
"target": "https://qa-backstage.forgerock.com/docs/sdks/latest",
"status": "301",
"condition": null
}
]
```

When I `curl` the first URL, I would expect to get `location: https://qa-backstage.forgerock.com/docs/sdks/latest/2019/10/21/beta.html`, but instead I get `location: https://qa-backstage.forgerock.com/docs/sdks/latest/2019/10/21/beta`. Notice that the `.html` extension is missing.

```
curl -I https://master.dhfqby5l2aw43.amplifyapp.com/2019/10/21/beta
HTTP/2 301
content-length: 0
location: https://qa-backstage.forgerock.com/docs/sdks/latest/2019/10/21/beta
server: CloudFront
date: Wed, 18 May 2022 12:42:39 GMT
x-cache: RefreshHit from cloudfront
via: 1.1 d6561aeeccb210202cf78b99f07c5234.cloudfront.net (CloudFront)
x-amz-cf-pop: CDG3-C2
x-amz-cf-id: ZeihZsInjsVhcEarfTkarT3htM0aI7w7c6FOFb3uLZfb2_y1JDJl9g==
```

Contributor guide

Open the contributing guide

Research direction

Start with the AWS Amplify redirects documentation and the linked FAQ, then reproduce the reported behavior using the supplied curl command and redirect configuration. Determine whether Amplify can preserve the .html suffix in the Location header; done means documenting the supported configuration or confirming the platform limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.