Created
March 15, 2017 18:40
-
-
Save tocttou/5a8ac5e09c593b6c50f4faaf7201c21e to your computer and use it in GitHub Desktop.
This file contains hidden or 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