1. Caddy version (2.4.3
):
2. How I run Caddy:
It is builded in a dockerfile from caddy build-alpine image
a. System environment:
Alpine linux, Docker
d. My complete Caddyfile or JSON config:
{
# Debug
{$DEBUG}
# HTTP/3 support
servers {
protocol {
experimental_http3
}
}
auto_https disable_redirects
local_certs
}
{$SERVER_NAME}
log
# Matches requests for HTML documents, for static files and for Next.js files,
# except for known API paths and paths with extensions handled by API Platform
@pwa expression `(
{header.Accept}.matches("\\btext/html\\b")
&& !{path}.matches("(?i)(?:^/docs|^/graphql|^/bundles/|^/_profiler|^/_wdt|\\.(?:json|html$|csv$|ya?ml$|xml$))")
)
|| {path} == "/favicon.ico"
|| {path} == "/manifest.json"
|| {path} == "/robots.txt"
|| {path}.startsWith("/_next")
|| {path}.startsWith("/sitemap")`
route {
root * /srv/api/public
push
# Add links to the API docs and to the Mercure Hub if not set explicitly (e.g. the PWA)
#header ?Link `</docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation", </.well-known/mercure>; rel="mercure"`
# Disable Google FLOC tracking if not enabled explicitly: https://plausible.io/blog/google-floc
header ?Permissions-Policy "interest-cohort=()"
# Comment the following line if you don't want Next.js to catch requests for HTML documents.
# In this case, they will be handled by the PHP app.
reverse_proxy @pwa http://{$PWA_UPSTREAM}
php_fastcgi unix//var/run/php/php-fpm.sock
encode zstd gzip
file_server
}
3. The problem I’m having:
I disabled the auto_https redirect but when i try to access my application directly on http i only get an empty response 200. If i access the same url on https, it works like a charm.
4. Error messages and/or full log output:
Http request example
{“level”:“info”,“ts”:1626855151.9384563,“logger”:“http.log.access”,“msg”:“handled request”,“request”:{“remote_addr”:“172.19.0.1:49908”,“proto”:“HTTP/1.1”,“method”:“GET”,“host”:“localhost”,“uri”:"/",“headers”:{“Sec-Ch-Ua-Mobile”:["?0"],“Upgrade-Insecure-Requests”:[“1”],“Accept”:[“text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.9”],“Sec-Fetch-Mode”:[“navigate”],“Accept-Language”:[“de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,fr;q=0.6”],“Sec-Ch-Ua”:["" Not;A Brand";v=“99”, “Google Chrome”;v=“91”, “Chromium”;v=“91"”],“User-Agent”:[“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36”],“Accept-Encoding”:[“gzip, deflate, br”],“Sec-Fetch-Site”:[“none”],“Sec-Fetch-Dest”:[“document”],“Connection”:[“keep-alive”],“Cache-Control”:[“max-age=0”],“Sec-Fetch-User”:["?1"]}},“common_log”:“172.19.0.1 - - [21/Jul/2021:08:12:31 +0000] “GET / HTTP/1.1” 0 0”,“duration”:0.0001057,“size”:0,“status”:0,“resp_headers”:{“Server”:[“Caddy”]}}
2021-07-21T08:12:32.038336900Z
5. What I already tried:
Disable all options i could think of, set https to off.
6. Links to relevant resources:
Link to the cloned repository with the caddy config template (under api/docker/caddy) and the used dockerfile (api/Dockerfile) → GitHub - api-platform/api-platform: Create REST and GraphQL APIs, scaffold Jamstack webapps, stream changes in real-time.