This file contains hidden or 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
| # The rewrite rule for nginx is to pick the first capture group’s match $1 from the path matcher. | |
| # | |
| # In the path matcher regex there are 2 capture groups (the inner groups are not captured): | |
| # /(...)|(.*) | |
| # ^$1 ^$2 | |
| # | |
| # So when we match anything that starts with "/api/" or ends with one of "css"/"js"/"png" this will | |
| # populate $1 and nginx passes the url unaltered upstream (-> /$1). If there is no such match, we match | |
| # everything else through the alternation: (.*) to populate $2, but we throw $2 away (we don't make use | |
| # of it in the rewrite target! An empty capture group, in this second scenario $1, will turn into an |