1. Caddy version (caddy version
): 2.4.5
2. How I run Caddy: Internal Web Application (dev.sf-console.listech.on.ca)
a. System environment: CentOS 8 → Docker
b. Command:
docker-compose up -d
c. Service/unit/compose file:
networks:
web:
external: true
listech:
external: true
services:
caddy:
image: caddy:2.4.5-alpine
labels:
- "traefik.enable=true"
- "traefik.http.routers.dev-sf-console.rule=Host(`dev.sf-console.listech.on.ca`)"
- "traefik.http.routers.dev-sf-console.entrypoints=web"
volumes:
- ./src:/var/www/html
- ./caddy/data:/data
- ./caddy/config:/config
- ./caddy/Caddyfile:/etc/caddy/Caddyfile
depends_on:
- php
networks:
- web
- default
- listech
php:
image: lti-php-oci:7.4-fpm-alpine
restart: unless-stopped
user: "root:root"
volumes:
- ./src:/var/www/html
networks:
- default
- listech
d. My complete Caddyfile or JSON config:
dev.sf-console.listech.on.ca:80 {
root * /var/www/html
php_fastcgi php:9000
file_server
}
3. The problem I’m having: I am attempting to move a legacy application from our apache web server to our docker server using caddy. When accessing http://dev.sf-console.listech.on.ca/APPLICATION/shopfloor.php at random I get text reading “file not found”. When this page does load it has a heartbeat request which 404 (response in devtools is “file not found”) randomly as well.
sample curl request
curl -v http://dev.sf-console.listech.on.ca/APPLICATION/shopfloor.php
* Trying 10.2.25.67:80...
* Connected to dev.sf-console.listech.on.ca (10.2.25.67) port 80 (#0)
> GET /APPLICATION/shopfloor.php HTTP/1.1
> Host: dev.sf-console.listech.on.ca
> User-Agent: curl/7.77.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Length: 16
< Content-Type: text/html; charset=UTF-8
< Date: Thu, 07 Oct 2021 20:27:31 GMT
< Server: Caddy
< Status: 404 Not Found
< X-Powered-By: PHP/7.4.16
<
File not found.
* Connection #0 to host dev.sf-console.listech.on.ca left intact
4. Error messages and/or full log output:
caddy_1 | {"level":"debug","ts":1633638718.6520164,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"php:9000","request":{"remote_addr":"172.18.0.2:43450","proto":"HTTP/1.1","method":"POST","host":"dev.sf-console.listech.on.ca","uri":"/APPLICATION/modules/footer/functions_ajax.php","headers":{"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0"],"X-Forwarded-Host":["dev.sf-console.listech.on.ca"],"X-Real-Ip":["10.2.31.250"],"Accept-Encoding":["gzip, deflate"],"X-Forwarded-Port":["80"],"X-Forwarded-Proto":["http"],"Content-Length":["38"],"Content-Type":["application/x-www-form-urlencoded"],"Cookie":["PHPSESSID=874d919ca0f099f1e9e6d34524c9ba16"],"Origin":["http://dev.sf-console.listech.on.ca"],"X-Forwarded-For":["10.2.31.250, 172.18.0.2"],"X-Forwarded-Server":["a6446fd7b628"],"Accept-Language":["en-US,en;q=0.5"],"Referer":["http://dev.sf-console.listech.on.ca/APPLICATION/shopfloor.php?terminal=AY-1%20POS1"],"Accept":["*/*"]}},"headers":{"X-Powered-By":["PHP/7.4.16"],"Content-Type":["text/html; charset=UTF-8"],"Status":["404 Not Found"]},"status":404}
caddy_1 | {"level":"debug","ts":1633638719.4011023,"logger":"http.reverse_proxy.transport.fastcgi","msg":"roundtrip","request":{"remote_addr":"172.18.0.2:43450","proto":"HTTP/1.1","method":"GET","host":"dev.sf-console.listech.on.ca","uri":"/APPLICATION/shopfloor.php?terminal=AY-1%20POS1","headers":{"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate"],"Cache-Control":["max-age=0"],"Cookie":["PHPSESSID=874d919ca0f099f1e9e6d34524c9ba16"],"Upgrade-Insecure-Requests":["1"],"Accept-Language":["en-US,en;q=0.5"],"X-Real-Ip":["10.2.31.250"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0"],"X-Forwarded-For":["10.2.31.250, 172.18.0.2"],"X-Forwarded-Host":["dev.sf-console.listech.on.ca"],"X-Forwarded-Port":["80"],"X-Forwarded-Proto":["http"],"X-Forwarded-Server":["a6446fd7b628"]}},"dial":"php:9000","env":{"AUTH_TYPE":"","CONTENT_LENGTH":"","CONTENT_TYPE":"","DOCUMENT_ROOT":"/var/www/html","DOCUMENT_URI":"/APPLICATION/shopfloor.php","GATEWAY_INTERFACE":"CGI/1.1","HTTP_ACCEPT":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8","HTTP_ACCEPT_ENCODING":"gzip, deflate","HTTP_ACCEPT_LANGUAGE":"en-US,en;q=0.5","HTTP_CACHE_CONTROL":"max-age=0","HTTP_COOKIE":"PHPSESSID=874d919ca0f099f1e9e6d34524c9ba16","HTTP_HOST":"dev.sf-console.listech.on.ca","HTTP_UPGRADE_INSECURE_REQUESTS":"1","HTTP_USER_AGENT":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0","HTTP_X_FORWARDED_FOR":"10.2.31.250, 172.18.0.2","HTTP_X_FORWARDED_HOST":"dev.sf-console.listech.on.ca","HTTP_X_FORWARDED_PORT":"80","HTTP_X_FORWARDED_PROTO":"http","HTTP_X_FORWARDED_SERVER":"a6446fd7b628","HTTP_X_REAL_IP":"10.2.31.250","PATH_INFO":"","QUERY_STRING":"terminal=AY-1%20POS1","REMOTE_ADDR":"172.18.0.2","REMOTE_HOST":"172.18.0.2","REMOTE_IDENT":"","REMOTE_PORT":"43450","REMOTE_USER":"","REQUEST_METHOD":"GET","REQUEST_SCHEME":"http","REQUEST_URI":"/APPLICATION/shopfloor.php?terminal=AY-1%20POS1","SCRIPT_FILENAME":"/var/www/html/APPLICATION/shopfloor.php","SCRIPT_NAME":"/APPLICATION/shopfloor.php","SERVER_NAME":"dev.sf-console.listech.on.ca","SERVER_PROTOCOL":"HTTP/1.1","SERVER_SOFTWARE":"Caddy/v2.4.5"}}
caddy_1 | {"level":"debug","ts":1633638719.4066246,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"php:9000","request":{"remote_addr":"172.18.0.2:43450","proto":"HTTP/1.1","method":"GET","host":"dev.sf-console.listech.on.ca","uri":"/APPLICATION/shopfloor.php?terminal=AY-1%20POS1","headers":{"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0"],"X-Forwarded-For":["10.2.31.250, 172.18.0.2"],"X-Forwarded-Host":["dev.sf-console.listech.on.ca"],"X-Forwarded-Port":["80"],"X-Forwarded-Proto":["http"],"X-Forwarded-Server":["a6446fd7b628"],"X-Real-Ip":["10.2.31.250"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate"],"Cache-Control":["max-age=0"],"Cookie":["PHPSESSID=874d919ca0f099f1e9e6d34524c9ba16"],"Upgrade-Insecure-Requests":["1"],"Accept-Language":["en-US,en;q=0.5"]}},"headers":{"X-Powered-By":["PHP/7.4.16"],"Content-Type":["text/html; charset=UTF-8"],"Status":["404 Not Found"]},"status":404}
5. What I already tried:
defining root in Caddyfile. Not sure what else to try.