|
||
---|---|---|
README.md | ||
config.json | ||
installer.sh | ||
proxy.rb |
README.md
ruby-rewrite-proxy
This project sets up a simple HTTP proxy using Ruby and Nginx. It's designed to forward requests to a specified host, with the option to replace certain strings in the response.
IT IS IN NO WAY FINISHED OR IN A STABLE STATE DO NOT FOLLOW THIS GUIDE, IT SERVERS AS A GUIDELINE ON HOW THE INSTALLATION AND FUNCTION SHOULD BE AND NOT YET AS A GUIDE
Installation
To install the necessary dependencies and set up the proxy, run the following command:
sudo bash installer.sh
Please dont forget to copy the installer from /root/ruby-proxy to your home directory and to change its owner recursively
This will:
Install Ruby and the 'webrick' gem.
Install Nginx and enable it to start on boot.
Create a directory in the current user's home directory called 'ruby-proxy'.
Clone this repository into the 'ruby-proxy' directory.
Prompt you to enter values for 'server_name' and 'proxy_set_header'.
Create an Nginx configuration file using the provided template and your input.
Enable the new Nginx site.
Reload Nginx to apply the changes.
After running the script, don't forget to adjust config.yml to your likings.
Configuration
The proxy.rb script reads its configuration from config.yml. This file specifies the host to proxy requests to, the port to listen on, and a set of string replacements to apply to the response.
Logging
The proxy.rb script logs its output to ruby-proxy.log in the same directory.
Usage
To start the proxy, run the following command:
ruby proxy.rb
This will start the proxy, listening on the port specified in config.yml.