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
3.01k stars 573 forks source link

Ability to add custom headers? #1365

Closed agieocean closed 6 months ago

agieocean commented 7 months ago

Is your feature request related to a problem? Please describe. Just would like a simple way to set headers, specifically I want to set the Access-Control-Allow-Origin header

I have this in my Apache config but it's not doing it from what I can tell: Header set Access-Control-Allow-Origin "*"

Describe the solution you'd like Some docs on how to set headers programatically

Describe alternatives you've considered Apache virtual host config

agieocean commented 7 months ago

Did some more troubleshooting, I guess the better question would be how am I Supposed to use a custom domain for proxy.py? This is what Ive currently got in Apache but it gives me a 500 error:

<VirtualHost *:443>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET,POST,PUT,DELETE,OPTIONS"
Header set Access-Control-Allow-Headers "Content-Type,Authorization,X-Requested-With"
Header set Access-Control-Allow-Credentials "true"
ServerName cors.y232.home
ServerAlias cors.y232.home
ProxyPreserveHost On
ProxyPass / https://127.0.0.1:8899/
ProxyPassReverse / https://127.0.0.1:8899/
SSLEngine on
SSLCertificateFile /etc/ssl/certs/cors.y232.home.crt
SSLCertificateKeyFile /etc/ssl/certs/cors.y232.home.key
</VirtualHost>