Unable to run Caddy with Magento 2 because of buffer sizes

1. The problem I’m having:

With Magento 2 an caddy I’m getting “502 Bad Gateway” in my local development environment.

To solve it I think I need to configure buffer sizes in Caddy.

Before I used Caddy, I had a nginx setup. There I could solve the problem with setting the different buffer sizes like described here:

I tried a lot of different approaches but didn’t get the setup running :frowning: Is there a possibility to set buffer sizes with caddy?

THX!

2. Error messages and/or full log output:

{"level":"debug","ts":1701764004.0487192,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"unix//usr/local/etc/php/php8.1.sock","duration":18.394300459,"request":{"remote_ip":"127.0.0.1","remote_port":"50097","client_ip":"127.0.0.1","proto":"HTTP/2.0","method":"GET","host":"dtack.test","uri":"/index.php","headers":{"Sec-Fetch-User":["?1"],"X-Forwarded-For":["127.0.0.1"],"X-Forwarded-Proto":["https"],"X-Forwarded-Host":["dtack.test"],"Sec-Fetch-Dest":["document"],"Accept-Language":["de-DE,de-AT;q=0.9,de;q=0.8,fr-CH;q=0.7,fr;q=0.6,de-CH;q=0.5,az;q=0.4,cs;q=0.3,es-ES;q=0.2,es;q=0.1,it;q=0.1,nl;q=0.1,da;q=0.1,nb;q=0.1,pl;q=0.1,sv;q=0.1,en-US;q=0.1,en;q=0.1,it-CH;q=0.1,lb;q=0.1"],"Sec-Fetch-Mode":["navigate"],"Accept-Encoding":["gzip, deflate, br"],"Sec-Fetch-Site":["none"],"Upgrade-Insecure-Requests":["1"],"Sec-Ch-Ua-Mobile":["?0"],"Cookie":[],"Sec-Ch-Ua-Platform":["\"macOS\""],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"],"Sec-Ch-Ua":["\"Chromium\";v=\"118\", \"Google Chrome\";v=\"118\", \"Not=A?Brand\";v=\"99\""],"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.7"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"dtack.test"}},"error":"EOF"}
{"level":"error","ts":1701764004.056942,"logger":"http.log.error.stdout","msg":"EOF","request":{"remote_ip":"127.0.0.1","remote_port":"50097","client_ip":"127.0.0.1","proto":"HTTP/2.0","method":"GET","host":"dtack.test","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"],"Sec-Fetch-Site":["none"],"Sec-Fetch-Dest":["document"],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Ch-Ua-Platform":["\"macOS\""],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-User":["?1"],"Accept-Language":["de-DE,de-AT;q=0.9,de;q=0.8,fr-CH;q=0.7,fr;q=0.6,de-CH;q=0.5,az;q=0.4,cs;q=0.3,es-ES;q=0.2,es;q=0.1,it;q=0.1,nl;q=0.1,da;q=0.1,nb;q=0.1,pl;q=0.1,sv;q=0.1,en-US;q=0.1,en;q=0.1,it-CH;q=0.1,lb;q=0.1"],"Sec-Ch-Ua":["\"Chromium\";v=\"118\", \"Google Chrome\";v=\"118\", \"Not=A?Brand\";v=\"99\""],"Sec-Fetch-Mode":["navigate"],"Accept-Encoding":["gzip, deflate, br"],"Cookie":[],"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.7"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"dtack.test"}},"duration":18.402497125,"status":502,"err_id":"bqcgn4q7y","err_trace":"reverseproxy.statusError (reverseproxy.go:1265)"}
{"level":"error","ts":1701764004.05706,"logger":"http.log.access.stdout","msg":"handled request","request":{"remote_ip":"127.0.0.1","remote_port":"50097","client_ip":"127.0.0.1","proto":"HTTP/2.0","method":"GET","host":"dtack.test","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"],"Sec-Fetch-Site":["none"],"Sec-Fetch-Dest":["document"],"Sec-Ch-Ua-Mobile":["?0"],"Sec-Ch-Ua-Platform":["\"macOS\""],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-User":["?1"],"Accept-Language":["de-DE,de-AT;q=0.9,de;q=0.8,fr-CH;q=0.7,fr;q=0.6,de-CH;q=0.5,az;q=0.4,cs;q=0.3,es-ES;q=0.2,es;q=0.1,it;q=0.1,nl;q=0.1,da;q=0.1,nb;q=0.1,pl;q=0.1,sv;q=0.1,en-US;q=0.1,en;q=0.1,it-CH;q=0.1,lb;q=0.1"],"Sec-Ch-Ua":["\"Chromium\";v=\"118\", \"Google Chrome\";v=\"118\", \"Not=A?Brand\";v=\"99\""],"Sec-Fetch-Mode":["navigate"],"Accept-Encoding":["gzip, deflate, br"],"Cookie":[],"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.7"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"dtack.test"}},"bytes_read":0,"user_id":"","duration":18.402497125,"size":0,"status":502,"resp_headers":{"Server":["Caddy"],"Alt-Svc":["h3=\":443\"; ma=2592000"]}}

I think the interesting part is:

{"level":"error","ts":1701764004.056942,"logger":"http.log.error.stdout","msg":"**EOF**","request":

3. Caddy version:

v2.7.5

4. How I installed and ran Caddy:

With brew on mac

a. System environment:

MACOsx Sonoma

b. Command:

c. Service/unit/compose file:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:

Tried a lot of different approaches but this is my current, simple one:

{
	debug
}
dtack.test {
	tls internal
	log stdout
	root * /Volumes/Development/_rocket-media/dtack/dtack-magento2/www/pub
	php_fastcgi unix//usr/local/etc/php/php8.1.sock
	file_server
}

5. Links to relevant resources:

https://magento.stackexchange.com/a/320939/86367

I think we have a pending change on the master branch which may fix this. Could you try a build of Caddy from master to see if it works better for you?

If not, we can explore further.

1 Like

Thx for the hint!

Do you know if there is an “easy” way to get the current master running on MacOSX?

Is there a way to install it with brew?

Sorry. I’m not a GO developer :frowning:

Do you have a ticket number for the pending change?

See Build from source — Caddy Documentation, it’s very easy to build from source. Install Go (just need to download & unzip it in your PATH, I guess brew might have the latest Go as well), then download xcaddy and run xcaddy build master.

1 Like

Thx for your help!

Sadly I still get the 502 Error with the build from the master branch:

2023/12/05 20:37:52.752	DEBUG	http.handlers.rewrite	rewrote request	{"request": {"remote_ip": "127.0.0.1", "remote_port": "59208", "client_ip": "127.0.0.1", "proto": "HTTP/2.0", "method": "GET", "host": "dtack.test", "uri": "/", "headers": {"Sec-Fetch-Mode": ["navigate"], "Sec-Fetch-Dest": ["document"], "Sec-Ch-Ua": ["\"Google Chrome\";v=\"119\", \"Chromium\";v=\"119\", \"Not?A_Brand\";v=\"24\""], "Sec-Ch-Ua-Mobile": ["?0"], "Sec-Ch-Ua-Platform": ["\"macOS\""], "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.7"], "Accept-Language": ["de-DE,de-AT;q=0.9,de;q=0.8,fr-CH;q=0.7,fr;q=0.6,de-CH;q=0.5,az;q=0.4,cs;q=0.3,es-ES;q=0.2,es;q=0.1,it;q=0.1,nl;q=0.1,da;q=0.1,nb;q=0.1,pl;q=0.1,sv;q=0.1,en-US;q=0.1,en;q=0.1,it-CH;q=0.1,lb;q=0.1"], "Cookie": [], "Accept-Encoding": ["gzip, deflate, br"], "Cache-Control": ["max-age=0"], "Upgrade-Insecure-Requests": ["1"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"], "Sec-Fetch-Site": ["none"], "Sec-Fetch-User": ["?1"]}, "tls": {"resumed": true, "version": 772, "cipher_suite": 4865, "proto": "h2", "server_name": "dtack.test"}}, "method": "GET", "uri": "/index.php"}
2023/12/05 20:37:52.753	DEBUG	http.handlers.reverse_proxy	selected upstream	{"dial": "/usr/local/etc/php/php8.1.sock", "total_upstreams": 1}
2023/12/05 20:37:52.754	DEBUG	http.reverse_proxy.transport.fastcgi	roundtrip	{"request": {"remote_ip": "127.0.0.1", "remote_port": "59208", "client_ip": "127.0.0.1", "proto": "HTTP/2.0", "method": "GET", "host": "dtack.test", "uri": "/index.php", "headers": {"Accept-Language": ["de-DE,de-AT;q=0.9,de;q=0.8,fr-CH;q=0.7,fr;q=0.6,de-CH;q=0.5,az;q=0.4,cs;q=0.3,es-ES;q=0.2,es;q=0.1,it;q=0.1,nl;q=0.1,da;q=0.1,nb;q=0.1,pl;q=0.1,sv;q=0.1,en-US;q=0.1,en;q=0.1,it-CH;q=0.1,lb;q=0.1"], "Sec-Fetch-User": ["?1"], "Accept-Encoding": ["gzip, deflate, br"], "Sec-Ch-Ua-Platform": ["\"macOS\""], "Cache-Control": ["max-age=0"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"], "Sec-Ch-Ua": ["\"Google Chrome\";v=\"119\", \"Chromium\";v=\"119\", \"Not?A_Brand\";v=\"24\""], "X-Forwarded-For": ["127.0.0.1"], "X-Forwarded-Proto": ["https"], "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.7"], "Sec-Ch-Ua-Mobile": ["?0"], "Upgrade-Insecure-Requests": ["1"], "Sec-Fetch-Site": ["none"], "Sec-Fetch-Mode": ["navigate"], "Sec-Fetch-Dest": ["document"], "X-Forwarded-Host": ["dtack.test"], "Cookie": []}, "tls": {"resumed": true, "version": 772, "cipher_suite": 4865, "proto": "h2", "server_name": "dtack.test"}}, "env": {"SERVER_PROTOCOL": "HTTP/2.0", "HTTP_CACHE_CONTROL": "max-age=0", "HTTP_X_FORWARDED_FOR": "127.0.0.1", "HTTP_SEC_FETCH_MODE": "navigate", "CONTENT_LENGTH": "", "REMOTE_ADDR": "127.0.0.1", "REMOTE_USER": "", "DOCUMENT_URI": "/index.php", "HTTP_HOST": "dtack.test", "HTTPS": "on", "HTTP_SEC_CH_UA": "\"Google Chrome\";v=\"119\", \"Chromium\";v=\"119\", \"Not?A_Brand\";v=\"24\"", "REMOTE_PORT": "59208", "REQUEST_METHOD": "GET", "SCRIPT_NAME": "/index.php", "CONTENT_TYPE": "", "REQUEST_SCHEME": "https", "SERVER_PORT": "443", "HTTP_SEC_FETCH_DEST": "document", "HTTP_COOKIE": "", "SERVER_NAME": "dtack.test", "DOCUMENT_ROOT": "/Volumes/Development/_rocket-media/dtack/dtack-magento2/www/pub", "HTTP_SEC_FETCH_SITE": "none", "HTTP_X_FORWARDED_HOST": "dtack.test", "REMOTE_IDENT": "", "QUERY_STRING": "", "SERVER_SOFTWARE": "Caddy/v2.7.6-0.20231204162315-4173e2c77ab8", "REQUEST_URI": "/", "SSL_PROTOCOL": "TLSv1.3", "HTTP_USER_AGENT": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", "HTTP_ACCEPT_ENCODING": "gzip, deflate, br", "HTTP_SEC_CH_UA_MOBILE": "?0", "AUTH_TYPE": "", "GATEWAY_INTERFACE": "CGI/1.1", "REMOTE_HOST": "127.0.0.1", "SCRIPT_FILENAME": "/Volumes/Development/_rocket-media/dtack/dtack-magento2/www/pub/index.php", "SSL_CIPHER": "TLS_AES_128_GCM_SHA256", "HTTP_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.7", "HTTP_UPGRADE_INSECURE_REQUESTS": "1", "HTTP_SEC_FETCH_USER": "?1", "HTTP_SEC_CH_UA_PLATFORM": "\"macOS\"", "PATH_INFO": "", "HTTP_X_FORWARDED_PROTO": "https", "HTTP_ACCEPT_LANGUAGE": "de-DE,de-AT;q=0.9,de;q=0.8,fr-CH;q=0.7,fr;q=0.6,de-CH;q=0.5,az;q=0.4,cs;q=0.3,es-ES;q=0.2,es;q=0.1,it;q=0.1,nl;q=0.1,da;q=0.1,nb;q=0.1,pl;q=0.1,sv;q=0.1,en-US;q=0.1,en;q=0.1,it-CH;q=0.1,lb;q=0.1"}, "dial": "/usr/local/etc/php/php8.1.sock", "env": {"HTTP_SEC_FETCH_DEST": "document", "HTTP_COOKIE": "", "CONTENT_TYPE": "", "REQUEST_SCHEME": "https", "SERVER_PORT": "443", "HTTP_X_FORWARDED_HOST": "dtack.test", "SERVER_NAME": "dtack.test", "DOCUMENT_ROOT": "/Volumes/Development/_rocket-media/dtack/dtack-magento2/www/pub", "HTTP_SEC_FETCH_SITE": "none", "REQUEST_URI": "/", "SSL_PROTOCOL": "TLSv1.3", "HTTP_USER_AGENT": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", "HTTP_ACCEPT_ENCODING": "gzip, deflate, br", "REMOTE_IDENT": "", "QUERY_STRING": "", "SERVER_SOFTWARE": "Caddy/v2.7.6-0.20231204162315-4173e2c77ab8", "SCRIPT_FILENAME": "/Volumes/Development/_rocket-media/dtack/dtack-magento2/www/pub/index.php", "SSL_CIPHER": "TLS_AES_128_GCM_SHA256", "HTTP_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.7", "HTTP_UPGRADE_INSECURE_REQUESTS": "1", "HTTP_SEC_CH_UA_MOBILE": "?0", "AUTH_TYPE": "", "GATEWAY_INTERFACE": "CGI/1.1", "REMOTE_HOST": "127.0.0.1", "HTTP_SEC_FETCH_USER": "?1", "HTTP_SEC_CH_UA_PLATFORM": "\"macOS\"", "PATH_INFO": "", "HTTP_X_FORWARDED_PROTO": "https", "HTTP_ACCEPT_LANGUAGE": "de-DE,de-AT;q=0.9,de;q=0.8,fr-CH;q=0.7,fr;q=0.6,de-CH;q=0.5,az;q=0.4,cs;q=0.3,es-ES;q=0.2,es;q=0.1,it;q=0.1,nl;q=0.1,da;q=0.1,nb;q=0.1,pl;q=0.1,sv;q=0.1,en-US;q=0.1,en;q=0.1,it-CH;q=0.1,lb;q=0.1", "SERVER_PROTOCOL": "HTTP/2.0", "HTTP_CACHE_CONTROL": "max-age=0", "HTTP_X_FORWARDED_FOR": "127.0.0.1", "DOCUMENT_URI": "/index.php", "HTTP_HOST": "dtack.test", "HTTPS": "on", "HTTP_SEC_CH_UA": "\"Google Chrome\";v=\"119\", \"Chromium\";v=\"119\", \"Not?A_Brand\";v=\"24\"", "HTTP_SEC_FETCH_MODE": "navigate", "CONTENT_LENGTH": "", "REMOTE_ADDR": "127.0.0.1", "REMOTE_USER": "", "REMOTE_PORT": "59208", "REQUEST_METHOD": "GET", "SCRIPT_NAME": "/index.php"}, "request": {"remote_ip": "127.0.0.1", "remote_port": "59208", "client_ip": "127.0.0.1", "proto": "HTTP/2.0", "method": "GET", "host": "dtack.test", "uri": "/index.php", "headers": {"Sec-Ch-Ua-Mobile": ["?0"], "Upgrade-Insecure-Requests": ["1"], "Sec-Fetch-Site": ["none"], "Sec-Fetch-Mode": ["navigate"], "Sec-Fetch-Dest": ["document"], "X-Forwarded-Host": ["dtack.test"], "Cookie": [], "Accept-Language": ["de-DE,de-AT;q=0.9,de;q=0.8,fr-CH;q=0.7,fr;q=0.6,de-CH;q=0.5,az;q=0.4,cs;q=0.3,es-ES;q=0.2,es;q=0.1,it;q=0.1,nl;q=0.1,da;q=0.1,nb;q=0.1,pl;q=0.1,sv;q=0.1,en-US;q=0.1,en;q=0.1,it-CH;q=0.1,lb;q=0.1"], "Sec-Fetch-User": ["?1"], "Accept-Encoding": ["gzip, deflate, br"], "Sec-Ch-Ua-Platform": ["\"macOS\""], "Cache-Control": ["max-age=0"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"], "Sec-Ch-Ua": ["\"Google Chrome\";v=\"119\", \"Chromium\";v=\"119\", \"Not?A_Brand\";v=\"24\""], "X-Forwarded-For": ["127.0.0.1"], "X-Forwarded-Proto": ["https"], "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.7"]}, "tls": {"resumed": true, "version": 772, "cipher_suite": 4865, "proto": "h2", "server_name": "dtack.test"}}}
2023/12/05 20:37:53.544	DEBUG	http.handlers.reverse_proxy	upstream roundtrip	{"upstream": "unix//usr/local/etc/php/php8.1.sock", "duration": 0.791044625, "request": {"remote_ip": "127.0.0.1", "remote_port": "59208", "client_ip": "127.0.0.1", "proto": "HTTP/2.0", "method": "GET", "host": "dtack.test", "uri": "/index.php", "headers": {"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.7"], "X-Forwarded-For": ["127.0.0.1"], "X-Forwarded-Proto": ["https"], "X-Forwarded-Host": ["dtack.test"], "Cookie": [], "Sec-Ch-Ua-Mobile": ["?0"], "Upgrade-Insecure-Requests": ["1"], "Sec-Fetch-Site": ["none"], "Sec-Fetch-Mode": ["navigate"], "Sec-Fetch-Dest": ["document"], "Sec-Ch-Ua-Platform": ["\"macOS\""], "Accept-Language": ["de-DE,de-AT;q=0.9,de;q=0.8,fr-CH;q=0.7,fr;q=0.6,de-CH;q=0.5,az;q=0.4,cs;q=0.3,es-ES;q=0.2,es;q=0.1,it;q=0.1,nl;q=0.1,da;q=0.1,nb;q=0.1,pl;q=0.1,sv;q=0.1,en-US;q=0.1,en;q=0.1,it-CH;q=0.1,lb;q=0.1"], "Sec-Fetch-User": ["?1"], "Accept-Encoding": ["gzip, deflate, br"], "Sec-Ch-Ua": ["\"Google Chrome\";v=\"119\", \"Chromium\";v=\"119\", \"Not?A_Brand\";v=\"24\""], "Cache-Control": ["max-age=0"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"]}, "tls": {"resumed": true, "version": 772, "cipher_suite": 4865, "proto": "h2", "server_name": "dtack.test"}}, "error": "EOF"}
2023/12/05 20:37:53.545	ERROR	http.log.error.stdout	EOF	{"request": {"remote_ip": "127.0.0.1", "remote_port": "59208", "client_ip": "127.0.0.1", "proto": "HTTP/2.0", "method": "GET", "host": "dtack.test", "uri": "/", "headers": {"Upgrade-Insecure-Requests": ["1"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"], "Sec-Fetch-Site": ["none"], "Sec-Fetch-User": ["?1"], "Accept-Encoding": ["gzip, deflate, br"], "Cache-Control": ["max-age=0"], "Sec-Fetch-Dest": ["document"], "Sec-Fetch-Mode": ["navigate"], "Sec-Ch-Ua": ["\"Google Chrome\";v=\"119\", \"Chromium\";v=\"119\", \"Not?A_Brand\";v=\"24\""], "Sec-Ch-Ua-Platform": ["\"macOS\""], "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.7"], "Accept-Language": ["de-DE,de-AT;q=0.9,de;q=0.8,fr-CH;q=0.7,fr;q=0.6,de-CH;q=0.5,az;q=0.4,cs;q=0.3,es-ES;q=0.2,es;q=0.1,it;q=0.1,nl;q=0.1,da;q=0.1,nb;q=0.1,pl;q=0.1,sv;q=0.1,en-US;q=0.1,en;q=0.1,it-CH;q=0.1,lb;q=0.1"], "Cookie": [], "Sec-Ch-Ua-Mobile": ["?0"]}, "tls": {"resumed": true, "version": 772, "cipher_suite": 4865, "proto": "h2", "server_name": "dtack.test"}}, "duration": 0.792205417, "status": 502, "err_id": "ua9yyvh6m", "err_trace": "reverseproxy.statusError (reverseproxy.go:1267)"}
2023/12/05 20:37:53.545	ERROR	http.log.access.stdout	handled request	{"request": {"remote_ip": "127.0.0.1", "remote_port": "59208", "client_ip": "127.0.0.1", "proto": "HTTP/2.0", "method": "GET", "host": "dtack.test", "uri": "/", "headers": {"Sec-Ch-Ua-Mobile": ["?0"], "Sec-Ch-Ua-Platform": ["\"macOS\""], "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.7"], "Accept-Language": ["de-DE,de-AT;q=0.9,de;q=0.8,fr-CH;q=0.7,fr;q=0.6,de-CH;q=0.5,az;q=0.4,cs;q=0.3,es-ES;q=0.2,es;q=0.1,it;q=0.1,nl;q=0.1,da;q=0.1,nb;q=0.1,pl;q=0.1,sv;q=0.1,en-US;q=0.1,en;q=0.1,it-CH;q=0.1,lb;q=0.1"], "Cookie": [], "Cache-Control": ["max-age=0"], "Upgrade-Insecure-Requests": ["1"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"], "Sec-Fetch-Site": ["none"], "Sec-Fetch-User": ["?1"], "Accept-Encoding": ["gzip, deflate, br"], "Sec-Fetch-Mode": ["navigate"], "Sec-Fetch-Dest": ["document"], "Sec-Ch-Ua": ["\"Google Chrome\";v=\"119\", \"Chromium\";v=\"119\", \"Not?A_Brand\";v=\"24\""]}, "tls": {"resumed": true, "version": 772, "cipher_suite": 4865, "proto": "h2", "server_name": "dtack.test"}}, "bytes_read": 0, "user_id": "", "duration": 0.792205417, "size": 0, "status": 502, "resp_headers": {"Alt-Svc": ["h3=\":443\"; ma=2592000"], "Server": ["Caddy"]}}

Still get the EOF Error: 2023/12/05 20:37:53.545 ERROR http.log.error.stdout

Caddy Version

v2.7.6-0.20231204162315-4173e2c77ab8 h1:FnUXbqlu6If8hbRqjrdxEUx/PXmnfasMNXmHuBzRv+k=

Hmm, dang.

I don’t know what the problem is. EOF implies Caddy ran out of content to read from the upstream.

Does your Magento app have any logs? You could enable capture_stderr (see php_fastcgi (Caddyfile directive) — Caddy Documentation) to possibly emit errors received by fastcgi.

2 Likes

I’ve been running several Magento sites with Caddy for years. My Caddy config doesn’t resemble yours at all.
You have a fully running setup here.

2 Likes

@svenakela the only practical difference is that you’re using a TCP socket between containers instead of @aqu using a unix socket. The rest of your config is not relevant to the problem at hand.

But anyway, that is evidence that a standard php_fastcgi directive can work for Magento. So I can only conclude that it’s not a problem with Caddy specifically.

2 Likes

Sorry, I was sick a couple of days …
Thx for your help!

I tried the capture_stderr feature - the error should appear in the caddy log?

In the application logs no errors are logged - with Symfony Local Web Server (Symfony Docs) everything works …

Is there a possibility in caddy to configure buffer sizes like mentioned here for nginx? magento2 - How to Solve 502 Bad Gateway error in Nginx Magento 2? - Magento Stack Exchange

1 Like

Caddy doesn’t buffer anything by default, it streams request and response bodies. I’m quite sure that’s not relevant to the problem, especially because clearly others are able to run their Magento apps without tweaking anything. It’s probably an issue with your php-fpm setup.

Something you could try, you could use https://frankenphp.dev/ which is a new tool which bundles Caddy + PHP together in a single binary which can run your apps. Avoids needing PHP-FPM altogether, works on Mac.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.