- 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/peterlugersredirects 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_engineredirects tohttp://www.google.com
- Request made to
- Ex:
- Run
go run main.go [input file] - The generated conf file will be output to
test.confin your working directory
- After running the
go runcommand and generating thetest.conffile, runmake proxy-testin 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.