tinyproxy path 설정

Younghwan Cha·2022년 12월 29일
0

server monitoring

목록 보기
4/11
post-thumbnail

너무 무거운 nginx 대신 비교적 가벼운 tinyproxy 를 사용하고 있다.
ReversePath 설정 도중 요청과 관련하여 궁금한 점이 생겼다.

# ReversePath "Path" "ProxyPath"

ReversePath "/example" "http://www.example.com/"
ReversePath "/example" "http://www.example.com"
ReversePath "/example/" "http://www.example.com/"
ReversePath "/example/" "http://www.example.com"

위 4개의 설정에는 어떤 차이점이 존재하고 어떤 것을 사용해야 할까?
예시를 통해서 하나씩 살펴보도록 하자.


ReversePath "/example" "http://www.example.com"

Request: http://[ip]//example/[address]
Proxy  : http://www.example.com/[address]

/auth/accounts 뒤의 /[address] 가 proxyPath 에 전달되었다.
다음 경우를 보자


ReversePath "/example" "http://www.example.com/"

INPUT: /auth/accounts/
PROXY: http://www.example.com/auth/accounts/
Rewriting URL: 
   http://[ip]/auth/accounts/[address]
-> http://localhost:1317/auth/accounts/[address]

여기서는 /auth/accounts/ 뒤의 [address] 만 넘어가서 proxyPath 에 붙어 요청이 전달된다.


INPUT: /auth/accounts/
PROXY: http://localhost:1317/auth/accounts
Rewriting URL: 
   http://[ip]/auth/accounts/[address] 
-> http://localhost:1317/auth/accounts[address]

/auth/accounts/[addrses] 가 proxyPath 에 그대로 붙은 것을 볼 수 있다.
이런 경우, proxyPath 에 / 를 추가하거나, 요청 측에서
http://[ip]/auth/accounts//[address] 와 같이 보내면 문제를 해결 할 수 있다.
마지막 경우도 마찬가지이다.

INPUT: /auth/accounts
PROXY: http://localhost:1317/auth/accounts
Rewriting URL: 
   http://[ip]/auth/accounts/[address]
-> http://localhost:1317/auth/accounts/[address]

이처럼 Path 뒤의 값을 그대로 proxyPath 에 전달하는 것을 볼 수 있다.

[ref]
http://tinyproxy.github.io/
https://linuxhint.com/install-tinyproxy-linux/

profile
개발 기록

0개의 댓글