G
G
ganzales2018-08-15 21:10:17
Nginx
ganzales, 2018-08-15 21:10:17

Nginx proxy_pass with arbitrary parameters?

There is a config:

location ~* ^/internal_redirect/(.*) {
proxy_pass http://google.com/$1;
}

When going to domain.com/internal_redirect/test, the server returns 502 Bad Gateway. If you use proxy_pass http://google.com, then it will proxy to google.com/internal_redirect/test . How to forward on google.com/test ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-08-15
@ganzales

location /internal_redirect/ {
    proxy_pass http://google.com/;
}

Or
location /internal_redirect/ {
    rewrite ^/internal_redirect/(.*) /$1 break;
    proxy_pass http://google.com;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question