How to proxy httpd call using netcat (nc)

时间:2016-10-20 12:40:00

标签: apache proxy httpd.conf netcat

I have a proxy pass which redirects all BE service calls to the API-Gateway. For debugging one particular scenario, I want to proxy all urls with base path /abc to a netcat proxy which would dumplt the complete request on console.

ATM I am using following proxy pass:

ProxyPass /abc/ http://localhost:8089/apigateway/api/

Whereas I am listening on port 8089 as follow:

nc -p 8089 localhost 8080

But the nc connection is closing up within few seconds after i run the above mentioned command. Any idea what am I do wrong?

When I curl the url http://localhost/abc/messaage, I see 503 as response.

1 个答案:

答案 0 :(得分:0)

以下为我工作:     sudo nc -l localhost 8089< abc.txt | tee -a in | nc localhost 8080 | tee -a out.html> def.txt

收听端口8089(httpd转发8089上的所有内容)。 nc然后将请求转发到端口8080(实际的apigateway)。在中间,它将请求和响应转储到不同的文件中。