Skip to content

Latest commit

 

History

History
77 lines (66 loc) · 2.28 KB

README.md

File metadata and controls

77 lines (66 loc) · 2.28 KB

Proxyl

Proxy outgoing requests to alternate servers with fine-grained control

Setup

Install using cargo

$ git clone https://github.com/sanket143/proxyl
$ cd proxyl
$ cargo install --path . --locked

Create certificate

This will create a certificate and key with expiry of 30 days

$ openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 30 -subj "/C=ZZ/ST=ZZ/L=ZZ/O=Proxyl/CN=Proxyl"

Add certificate for proxyl to use

$ proxyl add-certificate --cert-path ./cert.pem --key-path ./key.pem
Add and trust certificate in the browser or keychain

image image

Complete the server setup by running the server and adding the server address in proxy address

image

Add `~/.config/proxyl/config.toml` to fine-grain the proxy server

Example:

# Rules are the fundamental part of the configuration
# If the request matches any of the defined rule, it'll redirect the request to the said url
[rules.example-sanket143]
uri = "https://example.com:443/api"
method = "POST"
redirect_to = "http://localhost:3000/api"
headers = { "origin" = "https://example.com" }
body_re = "username=sanket143" # regex that will be applied with the content of the request body
enabled = false # whether the rule is active or not, by default the value is `true`

If there happened to be multiple rules with similar attributes, it can become repetitive. In that case, we can define config and extend those in the rules

[config.example]
uri = "https://example.com:443/api"
method = "POST"
redirect_to = "http://localhost:3000/api"
headers = { "origin" = "https://example.com" }

[rules.example-sanket143]
config = "example"
body_re = "username=sanket143"

[rules.example-octacat]
config = "example"
body_re = "username=octacat"
enabled = false

NOTES

  • Make sure you mention port number in the uri. NOTE 443 in https://example.com:443/api