-
Notifications
You must be signed in to change notification settings - Fork 538
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
Rewrite doesn't seem to be working #121
Comments
We faced a similar issue @vlidholt as we were using many regex rules to get our old urls working ( in the python based deployment ). As you can see in their source,
The rule is always going to be treated like a string. We had to modify it and redeploy. We did it like the python based solution. eg: const matchPatternStr = process.env.REWRITE_MATCH_PATTERN;
I know that aws needs to fix this, but till then hope this helps! |
Hey @mandys - Thanks for bringing this to our attention and providing a code snippet that's been working for you so far. Apologies you had to go in and modify then re-deploy to get everything to work. I've added a bug/issue ticket for this but if you'd like to take the code that's been working for you and wrap it into a PR, we'd be happy to review and merge it into our next minor release! |
Yet another simple workaround: - const parsedPath = path.replace(matchPattern, substitution);
+ const parsedPath = path.replace(new RegExp(matchPattern), substitution); Note, that you have to normalize the |
We have updated our solution, and I believe your issue has been fixed. If you still see the issue with the latest version (v4.2), please feel free to reopen the issue. You can refer to the recent changes here |
@beomseoklee are you sure version 4.2 addresses this issue? I checked through the diff for version 4.2 and I can't find any changes related to the path rewrite functionality: 19cbc3c |
@neilsh I think it was my mistake to group the open issues. |
Hi @beomseoklee, any news on this issue ? |
I've tried every single combination I can think of to get the rewrite rules to work, but not succeeded. There seem to be no examples whatsoever out there.
Also, the REWRITE_MATCH_PATTERN / REWRITE_SUBSTITUTION fields seem to suggest it's only possible to make one rewrite rule.
Is it possible to get an example of how to write a rule, and is it possible to have more than one rule?
The text was updated successfully, but these errors were encountered: