abhinavsingh / proxy.py

💫 Ngrok FRP Alternative • ⚡ Fast • 🪶 Lightweight • 0️⃣ Dependency • 🔌 Pluggable • 😈 TLS interception • 🔒 DNS-over-HTTPS • 🔥 Poor Man's VPN • ⏪ Reverse & ⏩ Forward • 👮🏿 "Proxy Server" framework • 🌐 "Web Server" framework • ➵ ➶ ➷ ➠ "PubSub" framework • 👷 "Work" acceptor & executor framework

Home Page:https://abhinavsingh.com/proxy-py-a-lightweight-single-file-http-proxy-server-in-python/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Forward incoming proxy requests with ProxyPoolPlugin don't load some websites

goodvanity opened this issue · comments

I have foreign proxy service and i want to forward requests through them using proxy.py and this command:
proxy --port 1090 --plugins proxy.plugin.ProxyPoolPlugin --proxy-pool username:password@proxysite.com:2222
Then some sites loaded like expected, but some sites not loaded at all.

For example:
curl --proxy 127.0.0.1:1090 https://www.reddit.com
output is html
log in proxy.py:
pid:14 [I] proxy_pool.access_log:219 - 172.26.0.1:52412 - CONNECT www.reddit.com:443 -> proxysite.com:2222 - 5130 bytes - 478.96 ms

but then i try another site, for example https://www.instagram.com
curl --proxy 127.0.0.1:1090 https://www.instagram.com
output:
curl: (56) Proxy CONNECT aborted
Chrome displays:
ERR_EMPTY_RESPONSE
log in proxy.py:
pid:20 [I] proxy_pool.access_log:219 - 172.26.0.1:55120 - CONNECT www.instagram.com:443 -> proxysite.com:2222 - 0 bytes - 10916.32 ms

I try this with docker and on the host, Windows and Linux, the result is the same. On the other hand if i use username:password@proxysite.com:2222 directly in curl or in browser then all works as expected. Sites do not change, if the site does not load, then it does not load after restart, reboot etc.

What could be the reason?

@goodvanity Thank you for reporting this. I'll need to check this out locally once.

I am wondering iff this could be related to any Via header added by local proxy.py. If you are able to see raw headers on remote proxy, may be you can help double check/verify. E.g. iff Via header is present, Instagram can detect it as a proxy request and may be try to abort the request (just a thought that crossed my mind).

@abhinavsingh thanks for the feedback

Browser(curl) --1--> Proxy.py --2--> Remote Proxy --3--> target site(instagram)

I only have access to 1 and 2 connections. Do you need any dump?