School project for M122
Go to file
Roxy 549b105bd6 added os detection 2023-07-05 22:53:02 +02:00
README.md silly 2023-07-05 22:42:05 +02:00
config.yml silly 2023-07-05 22:42:05 +02:00
installer.sh added os detection 2023-07-05 22:53:02 +02:00
proxy.rb silly 2023-07-05 22:42:05 +02:00

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.

Installation

To install the necessary dependencies and set up the proxy, run the following command:

bash installer.sh

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.