Skip to content

Commit a2bc61c

Browse files
authored
Update README.md
add explanation about how to use coockie or request token
1 parent 32206d9 commit a2bc61c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,23 @@ Install steps:
4949

5050
env JWT_SECRET;
5151
```
52-
1. If your JWT secret is Base64 (URL-safe) encoded, export the `JWT_SECRET_IS_BASE64_ENCODED` environment variable on the Nginx host, setting it equal to `true`. Then expose it to Nginx server:
52+
2. If your JWT secret is Base64 (URL-safe) encoded, export the `JWT_SECRET_IS_BASE64_ENCODED` environment variable on the Nginx host, setting it equal to `true`. Then expose it to Nginx server:
5353
```lua
5454
# nginx.conf:
5555

5656
env JWT_SECRET_IS_BASE64_ENCODED;
5757
```
5858

59+
3. If you want specify where this script should looking for the token, export the `NGINX_JWT_TOKEN_SITE` environment variable on the Nginx host, setting it equal to `HEADER`, `COOKIE` , `REQUEST`. Then expose it to Nginx server:
60+
```lua
61+
# nginx.conf:
62+
63+
env NGINX_JWT_TOKEN_SITE;
64+
```
65+
In case that you choose COOKIE or HEADER, this script try to found a "bearer" cookie or request parameter.
66+
67+
68+
5969
## Usage
6070

6171
Now we can start using the script in reverse-proxy scenarios to secure our backing service. This is done by using the [access_by_lua](https://github.com/openresty/lua-nginx-module#access_by_lua) directive to call the `nginx-jwt` script's [`auth()`](#auth) function before executing any [proxy_* directives](http://nginx.org/en/docs/http/ngx_http_proxy_module.html):

0 commit comments

Comments
 (0)