Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- request.path
- request.GET
- 클린 코드
- 효울적
- 클린코드
- Trre heap
- Djnago CSRF
- Proxy_pass
- is_ajax() not working
- CleanCode
- reCAPTCHA V2
- Filtering
- nginx
- 클린코드-함수
- Clean Code
- django
- 조회수 조작
- Django Ajax
- 합치기
- 포맷팅
- queryset filter
- queryset
- 트리란
- check ajax
- 복수 외래키
- 글자 수
- django 시작하기
- 자료구조
- render html
- HTTP
Archives
- Today
- Total
Yang 코딩 공부
proxy_pass Url 슬래시 여부에 따른 결과 정리 본문
경우의 수
모두 ~/foo/test/path 를 입력한다고 가정하자
1.location url / 미포함 && proxy_pass / 미포함
location ~/foo {
proxy_pass http://localhost:8080;
}
위의 경우 프록시 패스를 통해 서버로 전달되는 경로는 -> http://localhost:8080/foo/test/path
2.location url / 미포함 && proxy_pass / 포함
location ~/foo {
proxy_pass http://localhost:8080/;
}
위의 경우 프록시 패스를 통해 서버로 전달되는 경로는 -> http://localhost:8080/test/path
3.location url / 포함 && proxy_pass / 포함
location ~/foo/ {
proxy_pass http://localhost:8080/;
}
위의 경우 프록시 패스를 통해 서버로 전달되는 경로 -> http://localhost:8080/test/path
4.location url / 포함 && proxy_pass URL 포함
location ~/foo/ {
proxy_pass http://localhost:8080/foo;
}
위의 경우 프록시 패스를 통해 서버로 전달되는 경로는 -> http://localhost:8080/foo/test/path
5.location url / 미포함 && proxy_pass URL 포함 (URI와 매칭되지 않는 패턴 일 경우)
location ~/foo {
proxy_pass http://localhost:8080/xxx;
}
위의 경우 프록시 패스를 통해 서버로 전달되는 경로는 -> http://localhost:8080/xxx/test/path
문제 : nestjs를 통해 두개의 port로 동시에 서버를 배포할 때 nginx를 통해 접근 url을 결정하려 했으나 원하는 방식의 접근이 되지 않음
해결 방안 :
proxy_pass uri의 마지막에 /를 추가하여 필요없는 경로 부분을 삭제하였다.
간단한 작업이였는데 정확한 원리랑 서치할 키워드를 몰라 오래 찾은 것 같다 외우기 위해 기록