简体   繁体   中英

Removing basic authorization header in Nginx or Apache

The Nginx/Apache serves as a reverse proxy to the backend server. I'd like to write a rule to remove the Authorization header if the value starts with "Basic". That is the Nginx/Apache server won't pass the Basic auth header, but it will pass all other Authorization headers.

You will need to forge the 401 response. One way is to do than is by:

{
    error_page 401 = @error401
    location @error401 {
        ...
        proxy_set_header WWW-Authenticate ...

    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM