From 6b4877c114d43eca621bb5c13396dc3e09a101f2 Mon Sep 17 00:00:00 2001 From: Sutu Sebastian Date: Sat, 24 Oct 2026 21:59:56 +0300 Subject: [PATCH 1/2] docs: publish agent-discovery headers and markdown negotiation for /lossless --- apps/docs/public/.htaccess | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/apps/docs/public/.htaccess b/apps/docs/public/.htaccess index d310d5f..4987ec2 100644 --- a/apps/docs/public/.htaccess +++ b/apps/docs/public/.htaccess @@ -37,3 +37,69 @@ ErrorDocument 404 /lossless/404.html Header set X-Robots-Tag "noindex" + +# Agent discovery (isitagentready): Apache port of dist/_headers. +# Apache ignores that file, so this is what actually ships headers under /lossless. + + AddType application/json .json + + +# 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 "^/lossless/$" IS_LOSSLESS_HOME + SetEnvIf Request_URI "^/lossless/index\.html$" IS_LOSSLESS_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_LOSSLESS_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_LOSSLESS_HOME + + +# Extensionless file needs explicit type (else text/plain fails the scan). + + ForceType 'application/linkset+json; profile="https://www.rfc-editor.org/info/rfc9727"' + + +# Serve the catalog with its advertised media type (matches Link rel=ai-catalog). + + ForceType application/ai-catalog+json + + + + + Header set Access-Control-Allow-Origin "*" + + + +# Pragmatic Accept: text/markdown (static-first, not strict RFC). +# Subdir rules shadow the domain-root rewrite block, so both live here. + +RewriteEngine On + +RewriteCond %{REQUEST_URI} \.(css|js|mjs|map|png|jpe?g|webp|gif|svg|avif|ico|woff2?|ttf|otf|eot|xml|txt|json|pdf|mp4|webm|mp3|wav|ogg|zip)$ [NC] +RewriteRule ^ - [L] +RewriteCond %{REQUEST_URI} \.mdx?$ [NC] +RewriteRule ^ - [L] + +# /lossless/ -> /lossless/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] +RewriteRule ^$ /lossless/index.md [L,T=text/markdown] + +# /lossless/index.html -> /lossless/index.md (same representation as /lossless/) +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$ /lossless/index.md [L,T=text/markdown] + +# /lossless/ -> 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 %{REQUEST_FILENAME} !\.md$ [NC] +RewriteCond %{DOCUMENT_ROOT}/lossless/$1.md -f +RewriteRule ^(.+?)/?$ /lossless/$1.md [L,T=text/markdown] + From 5b7f7c09ab429ea9fb2b9fa7b946359983f88b7e Mon Sep 17 00:00:00 2001 From: Sutu Sebastian Date: Sat, 24 Oct 2026 22:13:49 +0300 Subject: [PATCH 2/2] fix: keep negotiated responses indexable (unset noindex on rewrite) --- apps/docs/public/.htaccess | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/docs/public/.htaccess b/apps/docs/public/.htaccess index 4987ec2..72e4826 100644 --- a/apps/docs/public/.htaccess +++ b/apps/docs/public/.htaccess @@ -33,6 +33,8 @@ ErrorDocument 404 /lossless/404.html Header set X-Robots-Tag "noindex" + # Negotiated responses serve .md twins at canonical URLs: keep those indexable. + Header unset X-Robots-Tag env=REDIRECT_NEGOTIATED_MD Header set X-Robots-Tag "noindex" @@ -89,17 +91,17 @@ RewriteRule ^ - [L] # /lossless/ -> /lossless/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] -RewriteRule ^$ /lossless/index.md [L,T=text/markdown] +RewriteRule ^$ /lossless/index.md [L,T=text/markdown,E=NEGOTIATED_MD:1] # /lossless/index.html -> /lossless/index.md (same representation as /lossless/) 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$ /lossless/index.md [L,T=text/markdown] +RewriteRule ^index\.html$ /lossless/index.md [L,T=text/markdown,E=NEGOTIATED_MD:1] # /lossless/ -> 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 %{REQUEST_FILENAME} !\.md$ [NC] RewriteCond %{DOCUMENT_ROOT}/lossless/$1.md -f -RewriteRule ^(.+?)/?$ /lossless/$1.md [L,T=text/markdown] +RewriteRule ^(.+?)/?$ /lossless/$1.md [L,T=text/markdown,E=NEGOTIATED_MD:1]