A simple reverse proxy in python
- Create local DNS entries in your DNS resolver to resolve target hostnames to a local server IP (Optional: Virtual IP in the router)
- Optional: Create NAT Port Forward from Virtual IP port 443 to high port (e.g. 9443) if you don't want the python server running as root
- Generate an SSL certificate for the original target domains, signed by your local network CA which must be trusted by client browsers and applications. The paths to the cert file and key file are defined on lines 10 and 11 of proxy.py
- Example:
python3 proxy.py --hostname tile.openstreetmap.org --port 9443 2>/dev/null
This proxy.py file includes modifications from the original to include:
- Line 15: Changed header merge function to work with Python 3.6
- Line 32: Modify the GET Request URL to work with the new destination URL path format
- Line 45: Changed resp.text to resp.content to proxy images instead of text
- Line 108: Added wrapper for SSL