Files
speckle-server/packages/frontend/nginx/nginx.conf
T

49 lines
1.3 KiB
Nginx Configuration File

server {
listen 80;
client_max_body_size 100m;
location / {
root /usr/share/nginx/html;
index app.html;
try_files $uri $uri/ /app.html;
}
location ~ ^/streams/.* {
default_type text/html;
content_by_lua_block {
local f = assert(io.open('/usr/share/nginx/html/app.html', "rb"))
local content = f:read("*all")
f:close()
local http_host = ngx.var.http_host
content = content:gsub('<meta property=og:title (.-)>', '<meta property=og:title content="Speckle Stream">')
local stream_id = ngx.var.uri:sub(10)
local img_tag = '<meta property=og:image content="https://' .. http_host .. '/preview/' .. stream_id .. '?postprocess=og&ts=' .. ngx.now() .. '">'
content = content:gsub('<meta property=og:image (.-)>', img_tag)
ngx.say(content)
}
}
location ~* ^/(graphql|explorer|(auth/.*)|(objects/.*)|(preview/.*)|(api/.*)) {
resolver 127.0.0.11 valid=30s;
set $upstream_speckle_server speckle-server;
client_max_body_size 100m;
proxy_pass http://$upstream_speckle_server:3000;
proxy_buffering off;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}