From 5c071f12e45e8620aac19f597dede02c72b901ea Mon Sep 17 00:00:00 2001 From: Sutu Sebastian Date: Sat, 24 Oct 2026 16:03:39 +0300 Subject: [PATCH 1/2] revert: agent-discovery follow-up .htaccess changes (500 on Apache) --- apps/docs/public/.htaccess | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/apps/docs/public/.htaccess b/apps/docs/public/.htaccess index 8c0a040..44c7fae 100644 --- a/apps/docs/public/.htaccess +++ b/apps/docs/public/.htaccess @@ -49,21 +49,16 @@ ErrorDocument 404 /codemap/404.html # Apache ignores that file; this is what actually ships headers under /codemap. AddType application/json .json + AddType application/gzip .tar.gz -# Compound extension needs a filename match — AddType splits on dots. - - ForceType application/gzip - - # Homepage Link header (RFC 8288 / RFC 9727 s3). Minimal form; keep in sync with dist/_headers. SetEnvIf Request_URI "^/codemap/$" IS_CODEMAP_HOME SetEnvIf Request_URI "^/codemap/index\.html$" IS_CODEMAP_HOME - # expr covers REDIRECT_ rename after internal rewrites (e.g. /codemap/index.html -> /codemap/index.md). - Header always set Link "; rel=\"api-catalog\"; type=\"application/linkset+json\", ; rel=\"ai-catalog\"; type=\"application/ai-catalog+json\", ; rel=\"service-desc\"; type=\"application/json\", ; rel=\"describedby\"; type=\"application/json\", ; rel=\"describedby\"; type=\"text/plain\", ; rel=\"alternate\"; type=\"text/markdown\"" "expr=%{ENV:IS_CODEMAP_HOME} || %{ENV:REDIRECT_IS_CODEMAP_HOME}" + Header always set Link "; rel=\"api-catalog\"; type=\"application/linkset+json\", ; rel=\"ai-catalog\"; type=\"application/ai-catalog+json\", ; rel=\"service-desc\"; type=\"application/json\", ; rel=\"describedby\"; type=\"application/json\", ; rel=\"describedby\"; type=\"text/plain\", ; rel=\"alternate\"; type=\"text/markdown\"" env=IS_CODEMAP_HOME # Extensionless file needs explicit type (else text/plain fails the scan). @@ -72,7 +67,7 @@ ErrorDocument 404 /codemap/404.html - + Header set Access-Control-Allow-Origin "*" @@ -89,17 +84,12 @@ RewriteRule ^ - [L] # /codemap/ -> /codemap/index.md RewriteCond %{HTTP:Accept} text/markdown [NC] -RewriteCond %{HTTP:Accept} !text/markdown(?:\s*;\s*(?!q\s*=)[^;,]+)*\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] +RewriteCond %{HTTP:Accept} !text/markdown\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] RewriteRule ^$ /codemap/index.md [L,T=text/markdown] -# /codemap/index.html -> /codemap/index.md (same representation as /codemap/) -RewriteCond %{HTTP:Accept} text/markdown [NC] -RewriteCond %{HTTP:Accept} !text/markdown(?:\s*;\s*(?!q\s*=)[^;,]+)*\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] -RewriteRule ^index\.html$ /codemap/index.md [L,T=text/markdown] - # /codemap/ -> twin .md RewriteCond %{HTTP:Accept} text/markdown [NC] -RewriteCond %{HTTP:Accept} !text/markdown(?:\s*;\s*(?!q\s*=)[^;,]+)*\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] +RewriteCond %{HTTP:Accept} !text/markdown\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] RewriteCond %{REQUEST_FILENAME} !\.md$ [NC] RewriteCond %{DOCUMENT_ROOT}/codemap/$1.md -f RewriteRule ^(.+?)/?$ /codemap/$1.md [L,T=text/markdown] From af73964fe545b601e3f1548a933d97362e140c48 Mon Sep 17 00:00:00 2001 From: Sutu Sebastian Date: Sat, 24 Oct 2026 16:46:00 +0300 Subject: [PATCH 2/2] fix: follow-ups without expr - two env directives, q hardened (harness-verified on httpd 2.4) --- apps/docs/public/.htaccess | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/docs/public/.htaccess b/apps/docs/public/.htaccess index 44c7fae..edec4a7 100644 --- a/apps/docs/public/.htaccess +++ b/apps/docs/public/.htaccess @@ -49,9 +49,13 @@ ErrorDocument 404 /codemap/404.html # Apache ignores that file; this is what actually ships headers under /codemap. AddType application/json .json - AddType application/gzip .tar.gz +# Compound extension needs a filename match — AddType splits on dots. + + ForceType application/gzip + + # Homepage Link header (RFC 8288 / RFC 9727 s3). Minimal form; keep in sync with dist/_headers. SetEnvIf Request_URI "^/codemap/$" IS_CODEMAP_HOME @@ -59,6 +63,9 @@ ErrorDocument 404 /codemap/404.html Header always set Link "; rel=\"api-catalog\"; type=\"application/linkset+json\", ; rel=\"ai-catalog\"; type=\"application/ai-catalog+json\", ; rel=\"service-desc\"; type=\"application/json\", ; rel=\"describedby\"; type=\"application/json\", ; rel=\"describedby\"; type=\"text/plain\", ; rel=\"alternate\"; type=\"text/markdown\"" env=IS_CODEMAP_HOME + # Internal rewrites rename request env vars with a REDIRECT_ prefix. + Header always set Link "; rel=\"api-catalog\"; type=\"application/linkset+json\", ; rel=\"ai-catalog\"; type=\"application/ai-catalog+json\", ; rel=\"service-desc\"; type=\"application/json\", ; rel=\"describedby\"; type=\"application/json\", ; rel=\"describedby\"; type=\"text/plain\", ; rel=\"alternate\"; type=\"text/markdown\"" env=REDIRECT_IS_CODEMAP_HOME + # Internal rewrites rename request env vars with a REDIRECT_ prefix. # Extensionless file needs explicit type (else text/plain fails the scan). @@ -67,7 +74,7 @@ ErrorDocument 404 /codemap/404.html - + Header set Access-Control-Allow-Origin "*" @@ -84,12 +91,17 @@ RewriteRule ^ - [L] # /codemap/ -> /codemap/index.md RewriteCond %{HTTP:Accept} text/markdown [NC] -RewriteCond %{HTTP:Accept} !text/markdown\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] +RewriteCond %{HTTP:Accept} !text/markdown(?:\s*;\s*(?!q\s*=)[^;,]+)*\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] RewriteRule ^$ /codemap/index.md [L,T=text/markdown] +# /codemap/index.html -> /codemap/index.md (same representation as /codemap/) +RewriteCond %{HTTP:Accept} text/markdown [NC] +RewriteCond %{HTTP:Accept} !text/markdown(?:\s*;\s*(?!q\s*=)[^;,]+)*\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] +RewriteRule ^index\.html$ /codemap/index.md [L,T=text/markdown] + # /codemap/ -> twin .md RewriteCond %{HTTP:Accept} text/markdown [NC] -RewriteCond %{HTTP:Accept} !text/markdown\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] +RewriteCond %{HTTP:Accept} !text/markdown(?:\s*;\s*(?!q\s*=)[^;,]+)*\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] RewriteCond %{REQUEST_FILENAME} !\.md$ [NC] RewriteCond %{DOCUMENT_ROOT}/codemap/$1.md -f RewriteRule ^(.+?)/?$ /codemap/$1.md [L,T=text/markdown]