-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix potential bugs with rewriting API backend redirects.
There were 2 bugs that could crop up when rewriting API backend redirects to match the frontend URL prefix: 1. The first "URL match" that matched the redirect's path would be used, but that wasn't necessarily the "URL match" that was actually being used for routing to the API backend. This could be problematic for API backends with multiple URL matches, if a more general prefix matched before the actual match being used. Fix this by only using the "URL match" belonging to the active one that was used during routing. 2. If the API backend responded with URL paths that were already rewritten to match the frontend prefix, the frontend prefix could end up getting duplicated twice in the resulting URL. We now try to better detect this situation and skip redirect rewriting if it appears like the redirect being returned is already valid for the given frontend prefix. Add more comprehensive redirect tests to try and better capture more of the possible redirect scenarios. Also make a couple tweaks to prefer regexes over lua string.gsub (since regexes can be compiled and should be more efficient). In the test suite, improve the unique hostname generation and better ensure thread-safety for generating unique IPs and numbers.
- Loading branch information
Showing
7 changed files
with
340 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.