특정 URL에 대한 요청을 localhost로 리디렉션하지 못했습니다.

특정 URL에 대한 요청을 localhost로 리디렉션하지 못했습니다.

수신 대기하는 서버가 있고 Chrome 확장 프로그램(일부 JSON 데이터)의 http://localhost:3000모든 요청을 .http://api.lingualeo.com/addwordhttp://localhost:3000

제가 한:

# sysctl -w net/ipv4/conf/all/route_localnet=1
# iptables -t nat -A OUTPUT -p tcp -m string \
    --string "POST /addword?port=1001" --algo kmp \
    -j DNAT --to-destination 127.0.0.1:3000

그러나 그것은 작동하지 않았고 나는 iptables -nvL깨끗했습니다.

나는 시도했다:

# iptables -t nat -A OUTPUT -p tcp -m string \
    --string "POST /addword?port=1001" --algo kmp \
    -o lo -j REDIRECT --to-ports 3000</code> 

그것도 작동하지 않았고 나는 iptables -nvL깨끗했습니다.

하지만,블로킹http://api.lingualeo.com/addword다음 명령을 사용하여 요청합니다 .

# iptables -I OUTPUT -p tcp -m string \
    --string "POST /addword?port=1001" --algo kmp -j DROP

예상대로 작동했습니다.

OS: 아치리눅스 x64

관련 정보