Answer the question
In order to leave comments, you need to log in
How to configure L5 Swagger to work with nginx proxy_pass?
There is an nginx configuration that, depending on the parameter in the URL, redirects to the desired bec
location ~ ^/main-back/ {
proxy_pass http://main-back:80;
rewrite /main-back/(.*) /$1 break;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
Answer the question
In order to leave comments, you need to log in
You're cutting off that part of the way withrewrite /main-back/(.*) /$1 break;
tried tried to register redirects in .htaccess
In general, I decided this:
location /main-back/ {
proxy_pass http://main-back:80/main-back/;
rewrite /main-back/(.*) /$1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
location /main-back/docs {
rewrite /main-back/(.*) /main-back/$1 break;
proxy_pass http://main-back:80/main-back/docs;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question