mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-27 17:37:18 +01:00
sulu-builder: integrate nginx-mod-ws-auth for WebSocket authentication
Include ws-auth endpoints and fix nginx template updates to properly add WebSocket upgrade map and upstream directives independently.
This commit is contained in:
parent
8bda910d6a
commit
df34679f38
2 changed files with 9 additions and 1 deletions
|
|
@ -1,5 +1,8 @@
|
|||
error_page 497 301 =307 https://$host:$server_port$request_uri;
|
||||
|
||||
# WebSocket authentication endpoints
|
||||
include /etc/nginx/ws-auth-locations.conf;
|
||||
|
||||
location /robots.txt {
|
||||
return 200 "User-agent: *\nDisallow: /\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,13 @@ update_nginx_uci_template()
|
|||
port="$(uci -q get mosquitto.sulu.port)"
|
||||
port="${port:-9009}"
|
||||
|
||||
if ! grep -w "upstream websocket" ${UCI_TEMPLATE} | grep -wq "127.0.0.1:${port}"; then
|
||||
# Add map for WebSocket connection upgrade if not present
|
||||
if ! grep -q "map \$http_upgrade \$connection_upgrade" ${UCI_TEMPLATE}; then
|
||||
sed -i '/#UCI_HTTP_CONFIG$/i\ map $http_upgrade $connection_upgrade { default upgrade; "" close; }' ${UCI_TEMPLATE}
|
||||
fi
|
||||
|
||||
# Add upstream websocket if not present
|
||||
if ! grep -q "upstream websocket" ${UCI_TEMPLATE}; then
|
||||
sed -i "/#UCI_HTTP_CONFIG$/i\ upstream websocket { server 127.0.0.1:${port}; }" ${UCI_TEMPLATE}
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue