1
0
mirror of https://github.com/docker/docs.git synced 2026-10-23 18:09:02 +03:00

10 Commits

Author SHA1 Message Date
David Karlsson
75deb7f882 docs: redirect bare Learn path 2026-08-03 14:12:21 +00:00
David Karlsson
58403db11d hack/releaser: preserve query string on CloudFront redirects (#25393)
## Summary

The CloudFront redirect Lambda (`cloudfront-lambda-redirects.js`)
dropped the request query string when issuing 301 responses, so UTM tags
and other params were lost on redirected URLs. This appends the query
string to the `Location` header of both the exact-match and prefix
redirects (the directory/markdown rewrite branch already forwards the
request, so params survive there).

Adds unit tests (`node --test`, zero dependencies) that render the Go
template the same way `aws.go` does and exercise the handler. The tests
run in CI via a new `releaser-test` Dockerfile stage / bake target,
baked alongside `releaser-build` in the existing `releaser` job.

## Learnings

- The redirect Lambda source is a Go `text/template`
(`{{.RedirectsJSON}}` / `{{.RedirectsPrefixesJSON}}`), rendered and
zipped by `hack/releaser/aws.go`. To unit-test it, substitute the
placeholders the same way `aws.go` does, then evaluate the result as a
CommonJS module.
- `test-go-redirects` validates redirect *data* against the built
`public/` site, so it's the wrong host for a fast pure-JS test — the
`releaser` job, which already builds from `hack/releaser`, is the
natural home and has no Hugo dependency.

Generated by Claude Code

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 11:42:09 +02:00
David Karlsson
6fe2b1154d Add markdown output for docs homepage 2026-04-24 15:00:46 +02:00
David Karlsson
c0bb56e6af Fix homepage markdown content negotiation
The CloudFront Lambda rewrote `/` with `Accept: text/markdown` to an
invalid `.md` URI, causing a 502 LambdaValidationError. Homepage has no
flattened markdown equivalent, so route to `/llms.txt` — the
agent-oriented markdown index of the site. Same handling for
`/index.html`.

Also set `Content-Type: text/markdown` on `llms.txt` at upload time, so
content negotiation responses and direct requests both advertise the
correct media type.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 15:29:41 +02:00
David Karlsson
9afd284fe4 fix: use the correct filepath to markdown rendition (no index.md)
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2026-01-13 17:13:43 +01:00
David Karlsson
390938c17c site: support content negotiation for markdown/plaintext
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2026-01-12 15:17:32 +01:00
CrazyMax
f77e196dc2 update lambda to handle secure s3 bucket
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-10-10 15:23:49 +02:00
Allie Sadler
266a8d4684 Revert "lambda: collapse redundant slashes in requests" (#21457)
Reverts docker/docs#21453
2024-11-18 17:19:41 +00:00
David Karlsson
209d00f1c1 lambda: collapse redundant slashes in requests
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-11-18 14:59:33 +01:00
David Karlsson
c7511a228f refactor: move scripts and utils to hack/ directory
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-11-15 09:28:19 +01:00