forked from devMls/nginx-jwt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
39 lines (30 loc) · 845 Bytes
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
env JWT_SECRET;
worker_processes 1;
events { worker_connections 1024; }
http {
sendfile on;
lua_package_path '/opt/openresty/nginx/lua/?.lua;;';
server {
listen 80;
location / {
proxy_pass http://backend:5000/;
}
location /secure {
access_by_lua '
local jwt = require("nginx-jwt")
jwt.auth()
';
proxy_pass http://backend:5000/secure;
}
location /secure/admin {
access_by_lua '
local jwt = require("nginx-jwt")
jwt.auth({
aud="^foo:",
roles=function (val) return jwt.table_contains(val, "marketing") end
})
';
proxy_pass http://backend:5000/secure/admin;
}
}
}