75 lines
1.8 KiB
YAML
75 lines
1.8 KiB
YAML
plugin_configs:
|
|
- id: 1
|
|
plugins:
|
|
serverless-pre-function:
|
|
phase: access
|
|
functions:
|
|
- |
|
|
local f = assert(loadfile("/usr/local/apisix/auth.lua"))
|
|
local mod = f()
|
|
return mod.access
|
|
routes:
|
|
- id: bff-api
|
|
name: bff-api
|
|
priority: 10
|
|
uris:
|
|
- /admin/*
|
|
- /api/*
|
|
- /device/*
|
|
methods:
|
|
- GET
|
|
- POST
|
|
- PUT
|
|
- OPTIONS
|
|
plugin_config_id: 1
|
|
plugins:
|
|
cors:
|
|
allow_origins: "*"
|
|
allow_methods: "GET,POST,PUT,OPTIONS"
|
|
allow_headers: "Authorization,Authorization-Type,Authorization-Auth,Refresh,X-Refresh,X-Service-Code,Sec-WebSocket-Key,Sec-WebSocket-Version,Sec-WebSocket-Accept,Connection,Upgrade"
|
|
max_age: 86400
|
|
upstream:
|
|
type: roundrobin
|
|
nodes:
|
|
"bff:10000": 1
|
|
|
|
- id: bff-ws
|
|
name: bff-ws
|
|
priority: 20
|
|
uris:
|
|
- /ws/*
|
|
methods:
|
|
- GET
|
|
enable_websocket: true # 放到route顶层,不在plugins内部!
|
|
plugins:
|
|
cors:
|
|
allow_origins: "*"
|
|
allow_methods: "GET"
|
|
allow_headers: "Authorization,Authorization-Type,Authorization-Auth,Refresh,X-Refresh,X-Service-Code,Sec-WebSocket-Key,Sec-WebSocket-Version,Sec-WebSocket-Accept,Connection,Upgrade"
|
|
max_age: 86400
|
|
upstream:
|
|
type: roundrobin
|
|
nodes:
|
|
"bff:10001": 1
|
|
|
|
- id: ws
|
|
name: ws
|
|
priority: 30
|
|
uris:
|
|
- /ws
|
|
methods:
|
|
- GET
|
|
enable_websocket: true
|
|
plugins:
|
|
cors:
|
|
allow_origins: "*"
|
|
allow_methods: "GET"
|
|
allow_headers: "Authorization,Authorization-Type,Authorization-Auth,Refresh,X-Refresh,X-Service-Code,Sec-WebSocket-Key,Sec-WebSocket-Version,Sec-WebSocket-Accept,Connection,Upgrade"
|
|
max_age: 86400
|
|
upstream:
|
|
type: roundrobin
|
|
nodes:
|
|
"ws:10002": 1
|
|
|
|
#END
|