- This project aims to:
- Parse nginx configuration files
- Parse custom JSON files
- Generate valid and semantically correct nginx config files from these JSON files
{
"routes": [
{
"host_endpoint": "/",
"proxy_to": "http://www.google.com",
"append_path": true
}
]
}
host_endpoint
: String The path on the host machine running nginxproxy_to
: String The endpoint to redirect toappend_path
: Boolean Determines whether or not the request path should be appended to the proxy path- Ex:
{ "append_path": true, "host_endpoint": "/peterlugers", "proxy_to": "http://www.yelp.com"
- Request made to
http://HOST/peterlugers
redirects tohttp://www.yelp.com/peterlugers
- Request made to
- Ex:
{ "append_path": false, "host_endpoint": "/google/search_engine", "proxy_to": "http://www.google.com" }
- Request made to
http://HOST/google/search_engine
redirects tohttp://www.google.com
- Request made to
- Ex:
- Run
go run main.go [input file]
- The generated conf file will be output to
test.conf
in your working directory
- After running the
go run
command and generating thetest.conf
file, runmake proxy-test
in order to run an nginx Docker container with the conf file mounted. - The container will be listening on
0.0.0.0:80
, so pointing your browser towardlocalhost/[path]
will allow you to test your proxy settings.