Wednesday, February 7, 2024

[SOLVED] nginx reverse proxy issue with www-authenticate

Issue

I want to route the incoming http requests to port 8081 locally using nginx reverse proxy, but application running on 8081 needs www-authenticate header authorization and postman gives me status 401 "Authentication failure" (image 1). But when i do reverse proxy with Apache httpd i get the results successfully.

failing for www-authenticate Postman results nginx www-authentication

Here its working for another request which uses basic authentications Postman results nginx basic type authentication

here is my nginx.conf

               location /webfolder/ {
                    proxy_pass http://localhost:8081;
                    proxy_set_header HOST $host;
                    proxy_set_header X-Forwarded-Proto $scheme;
                    proxy_set_header X-Real-IP $remote_addr;

Please help me on this issue as im not familiar with nginx, nginx version 1.16


Solution

This was because i have "underscores in header" ex CLIENT_SECRET_KEY

To resolve that, you need to add underscores_in_headers on; in your nginx.conf problem solved.



Answered By - madprinciple
Answer Checked By - Marie Seifert (WPSolving Admin)