addons
addons copied to clipboard
nginx_proxy: Support extra user-defined network ports and http block configuration
So in summary, the commits here provide two new features in the NGINX proxy:
- Add 5 customizable ports that can used to bind extra
servers within the existingshare/nginx_proxy/customization. - Add a new customization file that allows users to put statements inside the default
httpblock
My use case is making a specific server to re-serve a home assistant integration's URLs in a more protected manner. By having a dedicated server block and port, I can be sure no unintended locations are reachable from it and also apply more external firewall rules with the added separation.
As far as I can tell, there's no way to dynamically apply a container:host port mapping to an addon, so multiple unused and default-off mappings were added to allow a reasonable amount of flexibility for users going onward.
I'd also like to apply rate limiting to custom NGINX server blocks, which needs a limit_req_zone statement inside of the top-level http context to work in order to work.
Both commits tested in my local HAOS deployment and seems to work fine.
UI Examples
Considered Alternatives
- Use the same domain and port by putting new config data in
/share/nginx_proxy_default*.conf? In my use case, there's no way to then stop thelocation /block from running if my newlocationdoesn't match, which is a problem. - Use a different domain and listen on
443as well? SNI-based routing makes this a non-starter. - Use the existing
tcp/80mapping with your own external port? Using this port results in TLS errors because it attempts to redirect HTTPS traffic to a HTTP listener. - Fork the addon long term? This is a hassle to maintain and keep up to date with the upstream source here, and I'm sure there's someone else who has wanted functionality like this.....
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1: