Setting headers with NGINX auth_request and oauth2_proxy

时间秒杀一切 提交于 2019-12-02 17:37:34

Woop, figured it out. The correct NGINX config looks like this:

location / {                                               
    auth_request      /_auth;                             
    auth_request_set $user $upstream_http_x_user;       
    proxy_set_header x-user $user;                
    proxy_pass       http://backend_server;                
}                                                          

The issue is that you cannot assign the header directly into another header, you have to use auth_request_set to set the header into a variable and then assign that variable to a header.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!