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
https://abhinavsingh.com/proxy-py-a-lightweight-single-file-http-proxy-server-in-python/
BSD 3-Clause "New" or "Revised" License
2.92k stars 569 forks source link

Adding Custom Headers for Proxy-Authorization #1265

Open jealvin opened 1 year ago

jealvin commented 1 year ago

request for adding custom header when doing auth

Proxy-Authenticate: Basic realm="Proxy.py Server"

so it will show the message "Proxy.py Server" when request username and password

reference : https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authenticate

abhinavsingh commented 1 year ago

I know this can be added in the core itself. But in the meantime, one option is to achieve this using your own custom AuthPlugin plugin. Simply, copy over existing AuthPlugin and modify it as per your needs. The enable your auth plugin using the --auth-plugin flag. Default plugin raises ProxyAuthenticationFailed exception which internally returns a hardcoded PROXY_AUTH_FAILED_RESPONSE_PKT response back to client. You simply want to have your own custom response packet for failure scenarios.

I'll dig back into it and see how to generically add it within core flow.