dlinux-dashboard/proxy/proxy.conf

41 lines
942 B
Plaintext
Raw Normal View History

2025-01-09 13:23:27 -05:00
server {
listen 80;
listen [::]:80;
2025-01-10 05:53:03 -05:00
server_name {PROXY_DOMAIN};
2025-01-09 13:23:27 -05:00
location / {
proxy_pass http://127.0.0.1:5173;
}
location /api/ {
proxy_pass http://127.0.0.1:3000/;
2025-01-09 13:23:27 -05:00
}
}
server {
listen 80;
listen [::]:80;
2025-01-11 04:16:05 -05:00
server_name "~^(port-(?<port>.+)\.)?(?<container>.*)\.{PROXY_DOMAIN}";
2025-01-09 13:23:27 -05:00
location / {
if ($port = "") {
set $port "80";
}
set $ip '';
rewrite_by_lua_block {
2025-01-10 06:54:47 -05:00
local http = require("resty.http").new()
2025-01-09 13:23:27 -05:00
2025-01-10 08:45:56 -05:00
local res = http:request_uri("http://127.0.0.1:3000/containers/" .. ngx.var.container .. "/ip")
2025-01-10 06:54:47 -05:00
ngx.var.ip = res.body
2025-01-09 13:23:27 -05:00
}
proxy_pass http://$ip:$port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}