Repository navigation
Agent discovery headers and markdown negotiation for /codemap (isitagentready) #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,3 +44,53 @@ ErrorDocument 404 /codemap/404.html | |
| <FilesMatch "^llms(-full|-small)?\.txt$"> | ||
| Header set X-Robots-Tag "noindex" | ||
| </FilesMatch> | ||
|
|
||
| # Agent discovery (isitagentready) — Apache port of dist/_headers. | ||
| # Apache ignores that file; this is what actually ships headers under /codemap. | ||
| <IfModule mod_mime.c> | ||
| AddType application/json .json | ||
| AddType application/gzip .tar.gz | ||
| </IfModule> | ||
|
|
||
| # Homepage Link header (RFC 8288 / RFC 9727 s3). Minimal form; keep in sync with dist/_headers. | ||
| <IfModule mod_setenvif.c> | ||
| SetEnvIf Request_URI "^/codemap/$" IS_CODEMAP_HOME | ||
| SetEnvIf Request_URI "^/codemap/index\.html$" IS_CODEMAP_HOME | ||
| </IfModule> | ||
| <IfModule mod_headers.c> | ||
| Header always set Link "</codemap/.well-known/api-catalog>; rel=\"api-catalog\"; type=\"application/linkset+json\", </codemap/.well-known/ai-catalog.json>; rel=\"ai-catalog\"; type=\"application/ai-catalog+json\", </codemap/openapi.json>; rel=\"service-desc\"; type=\"application/json\", </codemap/agent-readability.json>; rel=\"describedby\"; type=\"application/json\", </codemap/llms.txt>; rel=\"describedby\"; type=\"text/plain\", </codemap/index.md>; rel=\"alternate\"; type=\"text/markdown\"" env=IS_CODEMAP_HOME | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| </IfModule> | ||
|
|
||
| # Extensionless file needs explicit type (else text/plain fails the scan). | ||
| <Files "api-catalog"> | ||
| ForceType 'application/linkset+json; profile="https://www.rfc-editor.org/info/rfc9727"' | ||
| </Files> | ||
|
|
||
| <IfModule mod_headers.c> | ||
| <FilesMatch "(^ai-catalog\.json$|^ard\.json$|^api-catalog$|index\.json$)"> | ||
| Header set Access-Control-Allow-Origin "*" | ||
| </FilesMatch> | ||
| </IfModule> | ||
|
|
||
| # Pragmatic Accept: text/markdown (static-first, not strict RFC). | ||
| # Subdir rules shadow the domain-root rewrite block, so both live here. | ||
| <IfModule mod_rewrite.c> | ||
| 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] | ||
|
|
||
| # /codemap/ -> /codemap/index.md | ||
| RewriteCond %{HTTP:Accept} text/markdown [NC] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Send When
|
||
| RewriteCond %{HTTP:Accept} !text/markdown\s*;\s*q\s*=\s*0(\.0*)?(\s*[;,]|\s*$) [NC] | ||
| RewriteRule ^$ /codemap/index.md [L,T=text/markdown] | ||
|
|
||
| # /codemap/<route> -> twin .md | ||
| RewriteCond %{HTTP:Accept} text/markdown [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] | ||
| </IfModule> | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the
.tar.gzAddType with a filename match.AddTypeassigns a type by individual dot-separated extension, so.tar.gznever matches as one key. The directive has no effect as written. A.tar.gzbundle gets its type only from another mapping, such as the.gzextension. AFilesMatchblock withForceTypeapplies the type to the compound filename directly.🐛 Suggested fix
Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct — AddType splits on dots, so
.tar.gznever matches as one key; no-op as written. Zero live impact (no .tar.gz artifacts ship — skills are skill-md — and system mime.types already maps .gz). Batching the proper FilesMatch/ForceType fix with the Audit follow-up instead of re-spinning CI here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SutuSebastian Understood. Based on the deployment details you provided, deferring this cleanup to the Audit follow-up is reasonable. The finding remains open pending that fix.
Would you like a separate GitHub issue to track it?
You are interacting with an AI system.