bunkerity / bunkerweb

🛡️ Open-source and next-generation Web Application Firewall (WAF)
https://www.bunkerweb.io
GNU Affero General Public License v3.0
6.46k stars 363 forks source link

[FEATURE] Allow multisite config in docker autoconf #551

Open Silur opened 1 year ago

Silur commented 1 year ago

Docker autoconf mode (as of 1.5.0) currently does not support assigning multisite config to the labels section. <ore precisely, the nginx config will pick the SERVER_NAME up but not the relevant bunkerweb.mysubdomain.example.com_AUTO_LETS_ENCRYPT etc entries

Currently if one container has multiple exposed ports that a reverse proxy has to separately attach in autoconf mode, we have to fire up two separate instances of this container.

It'd be if autoconf mode would also respect `-"bunkerweb.SERVER_NAME=app1.example.com app2.example.com" and then the relevant subdomain confs as seen in https://docs.bunkerweb.io/1.5.0/concepts/#multisite-mode

TheophileDiot commented 1 year ago

Hi @Silur, thank you for opening this issue. Did you consider using wildcards ? By looking at the documentation about server names I also find out that you can use regex inside server names. Right now sadly regex for server names won't work in the version 1.5.0 because of the regex but in the next release you will be able to use them.

It's not recommended but you can try this out by compiling the staging branch.

fl0ppy-d1sk commented 1 year ago

I think we should treat that special case in the next major release.

Here is what comes to my mind : add a special setting like AUTOCONF_MULTISITE=yes/no and if set to yes to a special service (as label) then we process the labels in multisite mode. The same way you describe @Silur but we need that switch in case someone wants to have multiple domains for the same service and don't want the multisite feature.

Anyway we also need to provide a way to add extra configs without containers (and with hot reload).