NGINX headers for single Location

Started by utahbmxer, April 28, 2021, 07:44:53 AM

Previous topic - Next topic
Hi

Using the WAF/NGINX for a few different apps and it's been awesome!  One thing I am looking to figure out is how can we add specific headers for a single Location via the GUI?  I am working on getting the notifications working for Bitwarden_rs which uses websockets for a specific location/path to route to another port on the backend server.

I need to add the following for /notifications/hub:

  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $http_connection;

I was able to create the location as needed and then edit /usr/local/etc/nginx/nginx.conf manually and reload the service, but I would rather not have to do this each time I make a change.  I noticed the notifications are working without, but would be nice to include them.

TIA!

April 28, 2021, 06:51:59 PM #1 Last Edit: April 28, 2021, 06:53:39 PM by Fright
Hi
if you on 21.1.5
nginx.conf conatains hooks in location blocks for additional directives
like "    include 072b5e24-3c80-42be-ac33-ad55e41e4aa7_post/*.conf;"
so you can  try to create dir in /usr/local/etc/nginx and put a .conf-file with your directives there

Oh, I see what you mean.  However I see a pre and a post include in the main server block, but nothing inside the individual Location blocks, or am I missing something?  It would be nice if the location did so I could add a directive to a single [Existing] location which has various WAF Polcies and other settings already applied from the GUI.  I guess I could hack something together by creating a unused Location so it creates the upstream (unless all upstreams are added regardless), etc. and then duplicate it into a new hook.  Thoughts?