bunkerity / bunkerweb

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

[FEATURE] Expose multiple HTTP/S Ports #216

Closed NoSpread closed 3 weeks ago

NoSpread commented 2 years ago

What's needed and why ? Unfortunately, due to the historical nature of the project, I cannot share all endpoints on port 80. This is also not possible under another sub-domain. So is it possible to also assign a dedicated port on a host to an endpoint?

So than for example you can customize the environment variables like this:

version: "3.9"
services:
  web:
 ...
    labels:
      bunkerized-nginx.USE_REVERSE_PROXY: "yes"
      bunkerized-nginx.SERVER_NAME_1: "web.example.com"
      bunkerized-nginx.REVERSE_PROXY_URL_1: "/"
      bunkerized-nginx.REVERSE_PROXY_HOST_1: "http://web:8080"
      bunkerized-nginx.HTTPS_PORT_2: 1234
      bunkerized-nginx.SERVER_NAME_2: "api.example.com"
      bunkerized-nginx.REVERSE_PROXY_URL_2: "/"
      bunkerized-nginx.REVERSE_PROXY_HOST_2: "http://web:8081"
...

Implementations ideas (optional) This should be possible by simply creating another server block in the nginx config, and then assigning it to the 2nd endpoint. The implementation should work similar to the multiple reverse proxy configurations.

NoSpread commented 2 years ago

I have solved this issue by including a custom nginx config.

fl0ppy-d1sk commented 2 years ago

Hello @NoSpread,

I don't know if it's a common case or a really specific one. Can you share more information about your use case ?

TheophileDiot commented 1 year ago

@NoSpread bump

NoSpread commented 1 year ago

I am sorry for not replying, kinda completely forgot about it.

Some of my webservices have to run on a specific port and cannot be exposed over port 443 or 80.

Example:

Client connects not only via port 80/443 but also via 1337 (as an example).

When I started to learn about Bunker, I did not find a way to set this in the configuration. So I just wrote my own config and included it in nginx. Also there was no way to set client side SSL certificates via the compose config. But when I found out that I could include all this with my own config in Bunker, it was not a big problem anymore.

I just hoped to have an option in the config to change the port per service or per subdomain, like it is possible with other options. It's just a very specific use case and with the ability to include custom nginx configs it's not really needed. Since if you have something really specific like this, you could just add it urself with a nginx config instead of needing an option in the compose file.