mirror of
https://github.com/BetterCorp/BetterFrame.git
synced 2026-05-26 21:26:33 +00:00
115 lines
3.6 KiB
Text
115 lines
3.6 KiB
Text
|
|
# BetterFrame Docker nginx config.
|
||
|
|
#
|
||
|
|
# Same routes as betterframe.conf, but upstreams use compose service names
|
||
|
|
# instead of localhost.
|
||
|
|
|
||
|
|
upstream betterframe_admin { server server:18080; keepalive 16; }
|
||
|
|
upstream betterframe_api { server server:18081; keepalive 16; }
|
||
|
|
upstream betterframe_ws { server server:18082; }
|
||
|
|
upstream betterframe_nodered { server nodered:1880; keepalive 8; }
|
||
|
|
|
||
|
|
limit_req_zone $binary_remote_addr zone=bf_public:10m rate=30r/s;
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name _;
|
||
|
|
|
||
|
|
client_max_body_size 16M;
|
||
|
|
|
||
|
|
location /admin/ {
|
||
|
|
proxy_pass http://betterframe_admin;
|
||
|
|
proxy_set_header Host $host;
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||
|
|
proxy_http_version 1.1;
|
||
|
|
proxy_set_header Connection "";
|
||
|
|
}
|
||
|
|
|
||
|
|
location = /admin { return 301 /admin/; }
|
||
|
|
location /setup { proxy_pass http://betterframe_admin; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; }
|
||
|
|
location /auth/ { proxy_pass http://betterframe_admin; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; }
|
||
|
|
location /static/ { proxy_pass http://betterframe_admin; }
|
||
|
|
|
||
|
|
location /api/kiosk/ {
|
||
|
|
proxy_pass http://betterframe_api;
|
||
|
|
proxy_set_header Host $host;
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
proxy_http_version 1.1;
|
||
|
|
proxy_set_header Connection "";
|
||
|
|
}
|
||
|
|
|
||
|
|
location /api/pair/ {
|
||
|
|
limit_req zone=bf_public burst=10 nodelay;
|
||
|
|
proxy_pass http://betterframe_api;
|
||
|
|
proxy_set_header Host $host;
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
}
|
||
|
|
|
||
|
|
location /api/admin/ {
|
||
|
|
proxy_pass http://betterframe_admin;
|
||
|
|
proxy_set_header Host $host;
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
}
|
||
|
|
|
||
|
|
location /ws/kiosk {
|
||
|
|
proxy_pass http://betterframe_ws;
|
||
|
|
proxy_http_version 1.1;
|
||
|
|
proxy_set_header Upgrade $http_upgrade;
|
||
|
|
proxy_set_header Connection "upgrade";
|
||
|
|
proxy_set_header Host $host;
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
proxy_read_timeout 86400s;
|
||
|
|
proxy_send_timeout 86400s;
|
||
|
|
}
|
||
|
|
|
||
|
|
location /nrdp/ {
|
||
|
|
auth_request /api/admin/_check;
|
||
|
|
rewrite ^/nrdp/(.*) /$1 break;
|
||
|
|
proxy_pass http://betterframe_nodered;
|
||
|
|
proxy_set_header Host $host;
|
||
|
|
proxy_http_version 1.1;
|
||
|
|
proxy_set_header Upgrade $http_upgrade;
|
||
|
|
proxy_set_header Connection "upgrade";
|
||
|
|
}
|
||
|
|
|
||
|
|
location /in/public/ {
|
||
|
|
limit_req zone=bf_public burst=20 nodelay;
|
||
|
|
rewrite ^/in/public/(.*) /public/$1 break;
|
||
|
|
proxy_pass http://betterframe_nodered;
|
||
|
|
}
|
||
|
|
|
||
|
|
location /in/kiosk/ {
|
||
|
|
auth_request /api/kiosk/_check;
|
||
|
|
rewrite ^/in/kiosk/(.*) /kiosk/$1 break;
|
||
|
|
proxy_pass http://betterframe_nodered;
|
||
|
|
}
|
||
|
|
|
||
|
|
location = /api/admin/_check {
|
||
|
|
internal;
|
||
|
|
proxy_pass http://betterframe_admin;
|
||
|
|
proxy_pass_request_body off;
|
||
|
|
proxy_set_header Content-Length "";
|
||
|
|
proxy_set_header Cookie $http_cookie;
|
||
|
|
proxy_set_header Authorization $http_authorization;
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
}
|
||
|
|
|
||
|
|
location = /api/kiosk/_check {
|
||
|
|
internal;
|
||
|
|
proxy_pass http://betterframe_api;
|
||
|
|
proxy_pass_request_body off;
|
||
|
|
proxy_set_header Content-Length "";
|
||
|
|
proxy_set_header Authorization $http_authorization;
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
}
|
||
|
|
|
||
|
|
location ~ ^/(healthz|readyz|version)$ {
|
||
|
|
proxy_pass http://betterframe_admin;
|
||
|
|
}
|
||
|
|
|
||
|
|
location = / {
|
||
|
|
proxy_pass http://betterframe_admin;
|
||
|
|
}
|
||
|
|
}
|