ngoduykhanh / wireguard-ui

Wireguard web interface
MIT License
3.77k stars 464 forks source link

GUI through a revers proxy using location (apache2) #565

Open goerdi opened 2 months ago

goerdi commented 2 months ago

Hi !

I figured out to use wirecard-ui through a proxy using an entire hostname, but i cant set it up using the Location directrive... i always jump back to https://hostname.tld//login?next=/ with "Not found" locaction should be http://hosname.tld/wireguard-ui/

<Location /wireguard-ui/>#
DirectorySlash On
Order allow,deny
Allow from all
Require all granted
ReWriteEngine on
ProxyPreserveHost on

ProxyPass http://127.0.0.1:5000/
ProxyPassReverse http://127.0.0.1:5000/
</Location>

Any hints ?

Ciao Gerd

goerdi commented 2 months ago

Hi !

OK with try and error i found it out ....

i put this in /etc/apache2/conf-available (ok you can ignore pw protection but i use it for this location.

----- wireguard.conf-----

Redirect` "/wireguard" "/wireguard/" <Location /wireguard/> DirectorySlash On Order allow,deny Allow from all AuthType Basic AuthName "VPN" AuthBasicProvider userfile userpw Require valid-user ReWriteEngine on ProxyPreserveHost on ProxyPass http://127.0.0.1:5000/wireguard/ ProxyPassReverse http://127.0.0.1:5000/wireguard/

i have the redirect statement at the beginning because after login i always ge directed to https://hostname.domain.tld/wireguard without a trailing "/"
Also do not forget to set BASE_PATH=/wireguard/ BIND_ADDRESS=127.0.0.1:5000 in .env file...

Ciao Gerd

goerdi commented 2 months ago

Done