URL Rewrite (!= Redirect) #58
Labels
No labels
cat
bug
cat
feature
cat
idea
cat
performance
cat
reliability
cat
security
cat
ui
difficulty
high
difficulty
low
difficulty
mid
prio
high
prio
low
prio
mid
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Deuxfleurs/guichet#58
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Netlify has an URL rewrite mechanism that is often used for SPA applications that have a single index.html + javascript that change its behavior according to the text in the URL bar.
For example, a blog post discussing this issue with React: https://www.codemzy.com/blog/cloudflare-reactjs-spa-routing
Netlify has a dedicated page here documenting its behavior: https://docs.netlify.com/routing/redirects/rewrites-proxies/
If we decompose the feature based on 2 examples:
If the requested URL does not map to an existing file, serve index.html
Even if the requested URL maps to an existing file, serve index.html
I think we can implement that on the Amazon API: https://docs.aws.amazon.com/AmazonS3/latest/API/API_RoutingRule.html
The first one would require a Condition with an HttpStatusCode 404.
The second one would not require any Condition.
To implement the rewrite for both cases, we could set the HttpStatusCode of the Redirect to 200:
https://docs.aws.amazon.com/AmazonS3/latest/API/API_Redirect.html
And implement this special behavior where we rewrite instead of redirecting.
It will probably an extension of the Amazon API, and might even break some commands that are checking data before sending them (I suppose they expect 3xx codes only), but on the server side, it should be a backward compatible change.