I have a web server which accepts https://www.example.com/API/ooo/xxx
, https://www.example.com/API/aaa/bbb
, and https://www.example.com/API/xxx/y
Use a return
statement. You can use a regular expression location
block to capture the part of the URI to return.
For example:
location ~ ^/API(/.*)$ {
return 307 $1$is_args$args;
}
Note that with the regular expression location
directive, its order within the configuration is significant, so you may need to move it. See this document for details.