Nginx 리버스 프록시 주소 설정 규칙에 관하여
Nginx config 파일에서
URL 뒤에 / 슬래시를 붙이느냐 마느냐는 매우 큰 차이가 난다.
만약 mysite.conf 설정이
location /api/ {
proxy_pass http://backend;
}
라고 되어있을때, http://abc.xyz/api/endpoint를 접속할 시
http://backend/api/endpoint; 로 고쳐 보내준다.
location /api/ {
proxy_pass http://backend/;
}
라고 슬래시를 붙이면,
http://backend/endpoint; 로 보낸다!
* 포트 번호를 지정할 경우 루트 도메인에 바로 붙여야 한다.
Just want to remind others that the slash(backend*/*) after your proxy_pass url is very important!
if the config is
location /api/ {
proxy_pass http://backend;
}
and you visit http://abc.xyz/api/endpoint
, you would be directed to http://backend/api/endpoint
;
if the config is
location /api/ {
proxy_pass http://backend/;
}
and you visit http://abc.xyz/api/endpoint
, you would be directed to http://backend/endpoint
.
That's the difference.
The proxy_pass
statement may optionally modify the URI before passing it upstream. See this document for details.
In this form:
location ^~ /api/ {
proxy_pass http://myserver/;
}
The URI /api/foo
is passed to http://myserver/foo
.
By deleting the trailing /
from the proxy_pass
statement:
location ^~ /api/ {
proxy_pass http://myserver;
}
The URI /api/foo
is now passed to http://myserver/api/foo
.
1xbet korean - Illegalbet.co.kr
1xbet korean. How to bet on soccer, basketball, tennis and more. Find out how to place 1xbet com gh wagers, including best odds on soccer and how to get started.