How to automate basic authorization via NGINX?

Get help, report and discuss bugs.
Post Reply
void.pointer
Posts: 59
Joined: 28 Sep 2014, 20:58

How to automate basic authorization via NGINX?

Post by void.pointer » 01 Jun 2019, 19:01

I have the following nginx configuration (for reverse proxy) for nzbget:

Code: Select all

set $upstream_nzbget http://nzbget:6789;

location /nzbget {
    auth_request /organizr/auth-0;
    proxy_pass $upstream_nzbget;

    include /config/nginx/proxy.conf;
    proxy_set_header Authorization "Basic base64==";
    proxy_pass_header Authorization;
}

location ~ /nzbget/(?:jsonrpc|jsonprpc|xmlrpc) {
    proxy_pass $upstream_nzbget;
}
When a user goes to `http://example.com/nzbget`, they get authenticated through Organizr and then taken to NZBGet. In this scenario, I want the basic authorization to be "bypassed", so I have my NGINX configuration add the header for me. However, this doesn't work I guess because NZBget still uses the `/nzbget/jsonrpc` (or other) endpoint for authentication.

The second scenario is if I have some third party application connect to NZBget remotely for API usage. In this case, I do not want authentication to go through Organizr. I want the third party app to have to enter the basic authorization credentials.

Does anyone know how I can set up NGINX to allow for these 2 distinct scenarios? The example I have above doesn't work because I am still prompted for password when I visit the web page.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests