Nginx Reverse Proxy URL Rewrite

Started by SkeelKat, February 03, 2020, 01:46:52 PM

Previous topic - Next topic
Hi Everyone,

I am struggling slightly getting URL re-writing to work on the NGINX Reverse Proxy Plug-in. Can anyone please help.

I have a Upstream Server
nextcloud_server = x.x.x.x port 80

I have a Upstream
nextcloud_upstream = nextcloud_server

I have a Location
nexcloud_location
URL Pattern = /
Match type = none
URL Rewriting = Nothing
Upstream = nextcloud_upstream
Force HTTPS = 1

I have a HTTP Server
Servername = cloud.xxxxxxxxx.xxx
Location = nextcloud_location
Certificates setup correctly

With this configuration everything is working as it should with https etc working. However I need to do URL rewriting

https://cloud.xxxxxxxxx.xxx/.well-known/caldav should rewrite to https://cloud.xxxxxxxxx.xxx/remote.php/dav
Can anyone explain step by step how this is achieved in the plugin?

I have tried several combinations of URL matching in location with rewrite url's but nothing seems to work.

my logic implies that I should duplicate the nextcloud_location to something like this

nexcloud_location_caldav
URL Pattern = /.well-known/caldav/
Match type = Case Insensitive Match ("~*")
URL Rewriting = {New URL Rewriting} <<<< I think this is my issue. I have no idea what to do in this section
Upstream = nextcloud_upstream
Force HTTPS = 1

Then simply add nextcloud_location_caldav to the HTTP Server...

Any help would be appreciated.


You should do that on the Webserver behind OPNsense and if that is nginx as well you will find that information in the nextcloud docs.

Hi Fabian.

I get what you are saying. Should be easy enough to do on the upstream server.

I would however love to understand how this can be done on OPNsense, for further use cases.

Sent from my EML-L29 using Tapatalk


via a rewrite rule you have to add to the http server.