Nginx Server Authentication
Utilizing Nginx's server_auth
After reading about how Server Authentication works, next we will need to set up the rewriting directive.
Configure the Nginx location block
You will need to modify your location block. Associated with your site. In Linux, this is typically located at /etc/nginx/sites-available/domain.com.conf
Native Nginx Rewrite
The Native Nginx rewrite block has been reported as not working for all setups. Use the Native Nginx Proxy Pass method if it fails.
Native Nginx Proxy Pass
Docker Container
SWAG/Letsencrypt Docker
There is already a preconfigured file for this. Find the organizr-auth.subfolder.conf.sample
and edit it the same way you did for your main Organizr file and remove the .sample.
For subfolders, just add one of the auth_request
lines into the subfolder config with the groups as explained above.
For subdomains, add the auth_request
same as you would for a subfolder and add an include for the file such as:
Note: If you are using a reverse proxy, this should be added on the reverse proxy layer
Subdomains
A subdomain allows you to have a custom application name for each app on your domain. For example, https://sonarr.domain.com for Sonarr and https://radarr.domain.com for Radar. For subdomains, you need to call back to the domain organizr is on, this can be done differently depending on your installation method.
Native, with local DNS setup (This can also apply for containers): http://app.domain.com/api/v2/auth/$1
Docker, using ip and port (This is assuming the container is running in bridge): http://[docker/hostIP]:[port]/api/v2/auth/$1
Reverse Proxy (subdirectory)
All you need to do is include one line per reverse proxy block as the very first line:
auth_request /organizr-auth/0;
If you are using something other than the default 0, change it out here. Other options are located on the Server Authentication page.
Here is a sample of a reverse proxy with admin access:
Excluding a location from authentication
Most of our examples already has this, but here is an explanation, using one of our examples(with headers removed)
NPM
Nginx Proxy Manager is a web application that helps you manage your Nginx configuration.
Please read the red bubbles in the screenshots carefully. Modify your Organizr proxy host configuration to include a custom location. Example where ip-address
is local IP and 8000
is the port where Organizr is hosted:
Modify the proxy host configuration for the service you want ServerAuth for. Modifications are needed in the Advanced section AND the Custom locations section. Example is a ServerAuth setup for Sonarr (as a subdomain):
Advanced Custom Nginx Configuration section:
organizr-auth
can be any string you like - Just make sure to make it match the Custom Location location
field on the next step.
Custom Locations Section:
Location:
organizr-auth
can be any string you like - Just make sure to make it match the Advanced Tab
Forward Hostname / IP
Only change the IP Address in this URL & Don't forget to change the PORT to match yours
Last updated