Open akefirad opened 4 years ago
Please refer to our documentation which provides examples on redirects. https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html
Let us know if that doesn't work for you.
No, not really. I already talked to AWS support and showed the whole thing. For some reason the exact regex above doesn't work.
@akefirad Did you ever get a resolution to this? It seems to me like regular expressions just do not work as advertised in the documentation.
Nope. Seems messed up 😞
Resolving due to age - please re-open if you are still experiencing issues.
Resolving due to age
Not sure if "age" can resolve such issues. Perhaps "Closing due to age" is a better wording.
please re-open if you are still experiencing issues.
Not sure why we should retry. There's no update regarding any fix. If nothing is fixed then people would still be experiencing the issue.
I'm experiencing this exact same problem
It's impossible to have regex working. For example, I want a 404 rewrite to index for ANY 404 path ending with "download/": /</^.+\/download\/?$/> -> index.html (404-200 rewrite)
Why this is not working (never match). If I use an exact URL it works perfectly. Are there any limitations on the number of 404 rewrites?
I'm seeing the same - regular expressions don't seem to work at all.
December 2021: I'm having the issue as well.
I think you need to escape the / characters like so \/ Can't get capture groups working though. Desperately needed - as per https://github.com/aws-amplify/amplify-hosting/issues/570
Please refer to our documentation which provides examples on redirects. https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html
Let us know if that doesn't work for you.
The only reference to regex is https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html#redirects-for-single-page-web-apps-spa which does not demonstrate capture groups. The docs also do not specifically mention regex
anywhere. There is a large opportunity to better document regex usage.
Agreed the documentation on regex in redirects is basically nonexistent. Can't get anything to work
Agree, they need better documentation for this.
I don't know if a capture group is possible, but I was able to make something work which is close enough for my purpose:
Source: </^\/(?!frontend\/).*$/><*>
Target:/frontend/<*>
So it is possible to combine the capture-like thing <*>
with a regex. Please note that you have to escape forward slashes as shown in my example. This is probably why it did not work for @akefirad and @iceye. Apparently, regexes need to be placed inside of </
and />
.
It is sad that AWS is unable to resolve this and provide proper docs. This issue has been reported almost four years ago!
Please describe which feature you have a question about? I'm trying to redirect
/<3-digit-integer>
to/code/<same-integer>
but for some reason I can't get it working. What I tried so far (I wasn't sure about the exact syntax):Can someone please take a look and tell me if I'm missing anything here. Thanks.