Forked from tocttou/nginx-lua-reverse-proxy-example.conf
Created
December 26, 2019 10:02
-
-
Save m1n9o/d3e93bf9ff549930f8de40650fea8fa7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 0.0.0.0:3001; | |
location / { | |
rewrite_by_lua_block { | |
local cookie_value = ngx.req.get_headers()["Cookie"] | |
if cookie_value ~= nil then | |
local jwt = cookie_value:match("access_token=([^ ]+)") | |
ngx.req.set_header("Authorization", "Bearer " .. jwt) | |
end | |
ngx.req.clear_header("Cookie") | |
} | |
proxy_pass http://0.0.0.0:3000; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment