Light, fluffy, and always free - The AWS Local Emulator alternative
docs(cloudfront): explain HTTPS signed URLs behind a proxy (#6164)
jwoa9510d33173462d
diff --git a/docs/services/cloudfront.md b/docs/services/cloudfront.mdindex f0ac4f9e56..898c205cdd 100644--- a/docs/services/cloudfront.md+++ b/docs/services/cloudfront.md@@ -411,6 +411,51 @@ Set `FLOCI_SERVICES_CLOUDFRONT_DOMAIN_SUFFIX=cloudfront.localhost.floci.io` to h`CreateDistribution` return that hostname as the `DomainName`, so test code can sign the API responseas it is.+### Behind a reverse proxy++When a proxy terminates HTTPS and forwards HTTP to Floci, sign the browser-visible HTTPS URL,+including its external hostname, port and path. Floci rebuilds the signed resource from the+request scheme and host, so it must receive the external scheme through trusted proxy headers.+A signature made for `https://` does not match a resource rebuilt as `http://`.++For a proxy that preserves `Host` and sets `X-Forwarded-Proto` and `X-Forwarded-Port`,+configure the Floci container with:++```yaml+environment:+ QUARKUS_HTTP_PROXY_PROXY_ADDRESS_FORWARDING: "true"+ QUARKUS_HTTP_PROXY_ALLOW_X_FORWARDED: "true"+ QUARKUS_HTTP_PROXY_ALLOW_FORWARDED: "false"+ QUARKUS_HTTP_PROXY_ENABLE_FORWARDED_HOST: "true"+ QUARKUS_HTTP_PROXY_TRUSTED_PROXIES: "<proxy source IP or CIDR>"+```++Replace the placeholder with the proxy's source address **as seen by Floci**. In Docker this may+be a bridge or gateway address rather than the host's loopback address. Quarkus ignores forwarded+headers from peers outside `QUARKUS_HTTP_PROXY_TRUSTED_PROXIES`; a missing proxy address leaves+Floci seeing HTTP and a valid HTTPS URL fails with `Signature does not match the policy`.++For example, when signing `https://e1z2x3c4v5b6n7.cloudfront.localhost.floci.io:19443/hello.txt`,+the proxy should forward these headers to Floci:++```http+Host: e1z2x3c4v5b6n7.cloudfront.localhost.floci.io:19443+X-Forwarded-Proto: https+X-Forwarded-Port: 19443+```++A non-default external port needs `X-Forwarded-Port`, even when the proxy preserves `Host`.+Applying `X-Forwarded-Proto` resets Quarkus' port, so preserving `Host` alone rebuilds the URL+without `:19443` and fails the signature check. Alternatively, send `X-Forwarded-Host` with+the external hostname **and port**; the forwarded-host setting above enables its use.++The proxy must replace client-supplied forwarded headers, and the trusted-proxy list should cover+only its actual peers. See [Quarkus reverse-proxy configuration](https://quarkus.io/version/3.40/guides/http-reference/#running-behind-a-reverse-proxy)+for other header layouts.++With these settings a valid proxy HTTPS signed URL succeeds; missing, expired or invalid+signatures must still return 403. Verify those cases through the proxy after configuring it.+## Not Supported (Phase 2)- Continuous deployment policies (`CreateContinuousDeploymentPolicy`, etc.)