Checks the admin files and the POST status in the CMS deployment check
The check now fetches real admin files (index.html, favicon, the css and js from the served index) and an unknown admin file. A POST with an empty body returns 405; without a body the HTTP/1.0 proxy hop answers 400. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -191,6 +191,17 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
# Een 200 met het verwachte content type voor een bestand van de admin
|
||||
expect_admin_file() {
|
||||
local path="$1" type="$2"
|
||||
fetch "$path"
|
||||
if [ "$status" != "200" ]; then
|
||||
fail "$path: status $status, verwacht 200"
|
||||
elif [[ "$(header Content-Type)" != "$type"* ]]; then
|
||||
fail "$path: Content-Type '$(header Content-Type)', verwacht $type"
|
||||
fi
|
||||
}
|
||||
|
||||
# Alleen met --cms: gedrag van de CMS-host zelf
|
||||
if [ "$cms_mode" -eq 1 ]; then
|
||||
# Cachebeleid: pagina's no-cache, assets onveranderlijk
|
||||
@@ -253,6 +264,25 @@ if [ "$cms_mode" -eq 1 ]; then
|
||||
|
||||
fetch /admin/
|
||||
if [ "$status" != "200" ]; then fail "/admin/: status $status, verwacht 200"; fi
|
||||
# De bestanden van de admin zelf, niet alleen de index: zonder die laadt
|
||||
# de pagina blanco (een catch-all route mag de static files niet afvangen)
|
||||
admin_css="$(grep -o '/admin/assets/[A-Za-z0-9_.-]*\.css' "$work/body" | head -n 1 || true)"
|
||||
admin_js="$(grep -o '/admin/assets/[A-Za-z0-9_.-]*\.js' "$work/body" | head -n 1 || true)"
|
||||
expect_admin_file /admin/index.html "text/html"
|
||||
expect_admin_file /admin/favicon-theme.png "image/png"
|
||||
if [ -z "$admin_css" ] || [ -z "$admin_js" ]; then
|
||||
fail "/admin/: geen css of js in de index gevonden"
|
||||
else
|
||||
expect_admin_file "$admin_css" "text/css"
|
||||
expect_admin_file "$admin_js" "text/javascript"
|
||||
fi
|
||||
# Een onbekend bestand onder /admin is een kale 404, geen HTML
|
||||
fetch /admin/assets/bestaat-niet.js
|
||||
if [ "$status" != "404" ]; then
|
||||
fail "/admin/assets/bestaat-niet.js: status $status, verwacht 404"
|
||||
elif grep -qi '<html' "$work/body"; then
|
||||
fail "/admin/assets/bestaat-niet.js: antwoordt met HTML"
|
||||
fi
|
||||
|
||||
fetch /api/v1/System/capabilities
|
||||
if [ "$status" != "200" ]; then
|
||||
|
||||
Reference in New Issue
Block a user