特定の URL へのリクエストをローカルホストにリダイレクトできない

特定の URL へのリクエストをローカルホストにリダイレクトできない

をリッスンするサーバーがあり、 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: Linux x64

関連情報