Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save m1n9o/d3e93bf9ff549930f8de40650fea8fa7 to your computer and use it in GitHub Desktop.
Save m1n9o/d3e93bf9ff549930f8de40650fea8fa7 to your computer and use it in GitHub Desktop.
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