OPNsense Forum

English Forums => Web Proxy Filtering and Caching => Topic started by: Hoe on March 19, 2021, 12:44:37 am

Title: Quick Reverse Proxy Question...
Post by: Hoe on March 19, 2021, 12:44:37 am
Hey guys,

I have NGNIX running a reverse proxy for my Pi-Hole amongst other things but it's a good example, Pi-Hole listens on... /admin

This annoys my OCD lol, and I wanted to know if I can use the URL Rewrite Function to effectively remove the need for the /admin, so instead of needing to use...

https://pi-hole.domain.com/admin

I would only need to use...

https://pi-hole.domain.com/

I know it's silly, pointless and almost an entire waste of time, but I like learning and playing but not really sure where to start with this one.

Thanks
Title: Quick Reverse Proxy Question...
Post by: Greelan on March 19, 2021, 12:39:27 pm
Have you tried a location block like:

Code: [Select]
location / {
    proxy_pass http://PIHOLE_IP/admin/;
}
Title: Re: Quick Reverse Proxy Question...
Post by: Hoe on March 20, 2021, 09:22:42 pm
No but I am not sure how I would do that in the NGINX Config either, there is no proxy pass field per say...

Any idea how I would go about doing that in the OPNsense config I don't have a code block like that. I tried using /admin in Path Prefix which seemed logical but it didn't work.

(https://i.ibb.co/k61vp9S/image-2021-03-20-202018.png)

Thanks
Title: Re: Quick Reverse Proxy Question...
Post by: Greelan on March 20, 2021, 09:38:38 pm
I don’t use the nginx plugin myself, but that would have been my guess too

Can you see what is being written in /usr/local/etc/nginx/nginx.conf when that configuration is included in the GUI? That may help to refine what should be in the GUI. Also try a trailing slash in Path Prefix, ie /admin/

The location block that I put above works on my nginx reverse proxy (running on a Linux host) for pi-hole
Title: Re: Quick Reverse Proxy Question...
Post by: fabian on March 20, 2021, 10:18:10 pm
proxy_pass is done via the upsteram servers. Did you regenerate the config and restart after changing the parameters?