To set the value of the proxy_set_header directive from another header, you can use the $http_ variable followed by the name of the header. For example, if you want to set the Authorization header of the downstream request from the X-Auth-Token header of the client request, you can use the following configuration:

location / {
    proxy_pass http://backend;
    proxy_set_header Authorization $http_x_auth_token;
}

In this example, the Authorization header of the downstream request will be set to the value of the X-Auth-Token header of the client request.

Note that the $http_ variable is case-insensitive, so you can use either X-Auth-Token or x-auth-token as the header name

nginx proxy_set_header from other headerhow to

原文地址: https://www.cveoy.top/t/topic/eHhY 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录