How to make a very simple HTTP proxy using werkzeug or another python request framework?

Is it possible to configure a listener on port 9090 and add a header, for example Host: test.host, to each request entering 9090 and send it to say 8080?

thank

EDIT: now I went with a reverse proxy using the hostname: port for any incoming request.

+5
source share
2 answers

Twisted -, . . twisted.web.proxy, , "Host:" ReverseProxyRequest.process, .

+4

- , - (, - Webapp), - -.

Apache:

Listen 0.0.0.0:9090
ProxyRequests off
<VirtualHost myhost:9090>
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
    ProxyPassReverseCookieDomain localhost myhost
</VirtualHost>

- Flask Werkzeug, httplib, , , (, ). , -, . , HTML. PyQuery, .

+1

All Articles