1

how can I get each slash part of the url into a variable to write the proxy URL?

Example:

https://example.com/part1/part2 or https://example.com/sub/8080

Then

proxy_pass http://$part1.example.com:$part2;

1 Answer 1

0

With something like this:

location ~* /(.+)/(.+)$ {
    set $hostpart $1;                                                                                            
    set $urlpart $2;                                                                                              

    proxy_pass http://$hostpart.example.com/$urlpart break;
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .