donaldzou / WGDashboard

Simple dashboard for WireGuard VPN written in Python & Vue.js
https://donaldzou.github.io/WGDashboard-Documentation/
Apache License 2.0
1.63k stars 252 forks source link

WGDashboard through Apache Proxy #439

Open goerdi opened 1 month ago

goerdi commented 1 month ago

Hi !

Im not sure its a bug or an enhancement request... i tried to set it up, but it fails (too many redirections)

Im refering to my question here https://github.com/donaldzou/WGDashboard/discussions/435 with wireguard-ui i realized that because they have just a setting you can add a base path like BASE_PATH=/wireguard/ then webgui is reachable under http://host.domain.tld:port/wireguard the adavantage is the you can add it on another side through a a proxy (like this from apache) https://otherhost.domain.tld/wireguard so you do not need a complete hostname and also no special certs for GUI I know then you might say "stay with wireguard-ui" but i want to change because WGDashboard has some features wireguard-ui does not have (like persitance of traffic) and i wannto change to it...

Ciao Gerd

DaanSelen commented 2 weeks ago

I'll try to get something setup! Hopefully I can report back soon.

DaanSelen commented 2 weeks ago

I tried to proxy through Apache2 and it works (on Debian).

Using this configuration file:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    # Enable proxy to localhost:10086
    ProxyPreserveHost On
    ProxyPass / http://localhost:10086/
    ProxyPassReverse / http://localhost:10086/

    # Optional: For security, limit access to the proxy
    # Allow only specific IPs, if needed
    # <Location />
    #   Order Deny,Allow
    #   Deny from all
    #   Allow from 192.168.1.0/24
    # </Location>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I combined this with the Docker container:

services:
  wgdashboard:
    image: donaldzou/wgdashboard:latest
    restart: unless-stopped
    container_name: wgdashboard
    #environment:
      #- tz=                # <--- Set container timezone, default: Europe/Amsterdam.
      #- global_dns=        # <--- Set global DNS address, default: 1.1.1.1.
      #- isolate=           # <--- Set the interfaces that will disallow peer communication, default: 'none'.
      #- public_ip=         # <--- Set public IP to ensure the correct one is chosen, defaulting to the IP give by ifconfig.me.
    ports:
      - 10086:10086/tcp
      - 51820:51820/udp
    volumes:
      - conf:/etc/wireguard
      - data:/data
    cap_add:
      - NET_ADMIN

volumes:
  conf:
  data:

From the docker files in this directory.

Then I see: image

So you can perhaps give me some more context?