Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions root/defaults/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,24 @@ server {
add_header X-Content-Type-Options "nosniff";
}
}
location = SUBFOLDERswitch {
proxy_set_header Host $host;
Comment thread
DL6ER marked this conversation as resolved.
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_buffering off;
proxy_pass http://127.0.0.1:SUPERVISOR_PORT/switch;
}
location = SUBFOLDERstatus {
Comment on lines +51 to +60
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description says a single regex location (location ~ ^/(switch|status)$) was added, but the nginx template actually adds two exact-match locations (location = ...switch and location = ...status). Please update the PR description to match the implementation (or change the config to the documented regex approach) so future maintainers aren’t misled.

Copilot uses AI. Check for mistakes.
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_buffering off;
proxy_pass http://127.0.0.1:SUPERVISOR_PORT/status;
}
error_page 500 502 503 504 /50x.html;
location = SUBFOLDER50x.html {
root /usr/share/selkies/web/;
Expand Down Expand Up @@ -106,6 +124,24 @@ server {
add_header X-Content-Type-Options "nosniff";
}
}
location = SUBFOLDERswitch {
proxy_set_header Host $host;
Comment thread
DL6ER marked this conversation as resolved.
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_buffering off;
proxy_pass http://127.0.0.1:SUPERVISOR_PORT/switch;
}
location = SUBFOLDERstatus {
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_buffering off;
proxy_pass http://127.0.0.1:SUPERVISOR_PORT/status;
}
error_page 500 502 503 504 /50x.html;
location = SUBFOLDER50x.html {
root /usr/share/selkies/web/;
Expand Down
5 changes: 5 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/init-nginx/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ NGINX_CONFIG=/etc/nginx/sites-available/default
CPORT="${CUSTOM_PORT:-3000}"
CHPORT="${CUSTOM_HTTPS_PORT:-3001}"
CWS="${CUSTOM_WS_PORT:-8082}"
Comment thread
DL6ER marked this conversation as resolved.
# Port of the selkies dual-mode supervisor API (/switch and /status).
# Only consulted when SELKIES_ENABLE_DUAL_MODE=true on the selkies side;
# this value drives nginx routing only, not the selkies bind port.
SUP="${SELKIES_SUPERVISOR_PORT:-8082}"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow-up patches default to 8084 once selkies-project/selkies#237 lands, converting this to a draft right now

Comment on lines +10 to +13
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shell variable name SUP is not descriptive and makes it harder to follow what’s being substituted into the nginx template. Consider renaming it to something explicit like SUPERVISOR_PORT (or SELKIES_SUPERVISOR_PORT_NGINX) and use that in the sed replacement for readability/maintainability.

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +13
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SELKIES_SUPERVISOR_PORT is currently a footgun: selkies hardcodes the supervisor bind port to 8082, so setting this env var to any other value will silently break /switch and /status routing (nginx will proxy to a port where nothing is listening). Consider either hardcoding 8082 in nginx until selkies supports configuring it, or explicitly validating the value and warning/ignoring anything other than 8082.

Suggested change
# Only consulted when SELKIES_ENABLE_DUAL_MODE=true on the selkies side;
# this value drives nginx routing only, not the selkies bind port.
SUP="${SELKIES_SUPERVISOR_PORT:-8082}"
# Selkies currently binds the supervisor API to 8082 only; this script
# configures nginx routing and must not allow unsupported values here.
if [ -n "${SELKIES_SUPERVISOR_PORT+x}" ] && [ "${SELKIES_SUPERVISOR_PORT}" != "8082" ]; then
printf 'WARNING: Ignoring unsupported SELKIES_SUPERVISOR_PORT=%s; selkies currently binds the supervisor API to 8082 only.\n' "${SELKIES_SUPERVISOR_PORT}" >&2
fi
SUP="8082"

Copilot uses AI. Check for mistakes.
CUSER="${CUSTOM_USER:-abc}"
SFOLDER="${SUBFOLDER:-/}"
FILE_MANAGER_PATH="${FILE_MANAGER_PATH:-$HOME/Desktop}"
Expand All @@ -31,6 +35,7 @@ cp /defaults/default.conf ${NGINX_CONFIG}
sed -i "s/3000/$CPORT/g" ${NGINX_CONFIG}
sed -i "s/3001/$CHPORT/g" ${NGINX_CONFIG}
sed -i "s/CWS/$CWS/g" ${NGINX_CONFIG}
sed -i "s/SUPERVISOR_PORT/$SUP/g" ${NGINX_CONFIG}
sed -i "s|SUBFOLDER|$SFOLDER|g" ${NGINX_CONFIG}
sed -i "s|REPLACE_DOWNLOADS_PATH|$FILE_MANAGER_PATH|g" ${NGINX_CONFIG}
s6-setuidgid abc mkdir -p ${FILE_MANAGER_PATH}
Expand Down
Loading