Skip to content

Commit f97369e

Browse files
core: tools: nginx: Add a 404 if extension is not registered
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
1 parent 4b4a7cd commit f97369e

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

core/tools/nginx/nginx.conf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,19 @@ http {
261261
location ~ ^/redirect-port/(?<port>\d+) {
262262
return 301 $scheme://$host:$port;
263263
}
264+
265+
# Catch-all for unknown extensions: returns a real 404 instead of
266+
# falling through to the Vue SPA.
267+
location ^~ /extensionv2/ {
268+
error_page 404 = @extension_not_found;
269+
return 404;
270+
}
271+
272+
location @extension_not_found {
273+
default_type application/json;
274+
return 404 '{"error":"extension_not_found","message":"No registered extension matches this URL, the extension might not be running or installed."}';
275+
}
276+
264277
include /home/pi/tools/nginx/extensions/*.conf;
265278
}
266279
}

0 commit comments

Comments
 (0)