简体   繁体   中英

nginx proxy_pass not working in a expected way

I have front proxy as apache and back proxy as nginx. back proxy config is like below

location /my-app {
    proxy_pass http://localhost:18080/my-app/;
    fastcgi_intercept_errors off;
}

The problem is whenever the request sent to upstream from back proxy then double slash added

to upstream --> /my-app//myappPath

I have tried to add slash at the end of location like below to avoid double slash but back proxy not receive any request from my front proxy. so no requests to upstream application. Please kindly help me how to avoid this double slash situation in my back proxy.

location /my-app/ {
    proxy_pass http://localhost:18080/my-app/;
    fastcgi_intercept_errors off;
}

You are using this directive:

proxy_pass http://localhost:18080/my-app/

Remove the "/" at the end to:

proxy_pass http://localhost:18080/my-app

That will take care of the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM