Running Proxy.py as a Lightweight HTTP Proxy on EC2
This note describes how to set up Proxy.py, a lightweight HTTP proxy server, on an EC2 instance.
This note describes how to set up Proxy.py, a lightweight HTTP proxy server, on an EC2 instance.
On May 27, 2022, AWS introduced port forwarding to remote hosts. For more information, please refer to the official documentation.
Setting Up
Install Proxy.py with the following command:
pip install proxy.pyStart Proxy.py using this command:
proxy --port 8080To ensure Proxy.py runs even after closing the SSH session, use the following command:
nohup proxy --port 8080 > /dev/null &After launching, you should see logs similar to this in the terminal:
pid:3330 [I] plugins.load:85 - Loaded plugin proxy.http.proxy.HttpProxyPluginpid:3330 [I] tcp.listen:82 - Listening on 127.0.0.1:8080pid:3330 [I] pool.setup:108 - Started 1 acceptors in threaded mode...Testing
Establish an SSH tunnel to your EC2 instance:
ssh -L 8080:localhost:8080 -i .ssh/YOUR_PRIVATE_KEY ec2-user@YOUR_HOSTTest the proxy by sending a request to Google:
curl www.google.com -x http://localhost:8080If the proxy is working correctly, you should receive an HTML response from Google.
Related posts
Monitoring OPC UA Variable Nodes with Python
This note describes how to efficiently monitor OPC UA server variable nodes with Python.
Performing OCR on Japanese PDFs Using Tesseract and Pytesseract
This example demonstrates how to perform OCR on Japanese PDFs using Tesseract OCR v4 and pytesseract.
Installing Python Packages Without Internet Access
This note describes how to install python packages without Internet connectivity.
Connecting to EC2 with Session Manager (No SSH Required)
This note describes how to use Systems Manager - Session Manager.
Debugging PHP Remotely on AWS EC2 with PhpStorm and Xdebug
This note describes how to debug PHP remotely using PhpStorm and Xdebug.
