API Platform – Windows WSL2 and Docker Caddy not working

I’m trying to make my first website with API Platform (I’m already fine with Next.js and Symfony, so the environment is familiar to me !) using the API Platform docker installation.

I’m working on Windows 11, with Ubuntu on WSL2 and Docker for Windows. All containers have no problem to launch, and throw no errors. The problem is it’s impossible to access to the PWA website (localhost/, and localhost/admin), but /docs seems to work (without trusting certificate). Here is some Caddy error logs

caddy_1     | {"level":"error","ts":1637357776.747518,"logger":"http.log.access","msg":"handled request","request":{"remote_addr":"172.25.0.1:45048","proto":"HTTP/2.0","method":"GET","host":"localhost","uri":"/.well-known/mercure","headers":{"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"],"Caddy-Push":["1"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,zh-CN;q=0.6,zh;q=0.5"],"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"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","proto_mutual":true,"server_name":"localhost"}},"common_log":"172.25.0.1 - - [19/Nov/2021:21:36:16 +0000] "GET /.well-known/mercure HTTP/2.0" 400 27","user_id":"","duration":0.0001409,"size":27,"status":400,"resp_headers":{"X-Xss-Protection":["1; mode=block"],"Content-Security-Policy":["default-src 'self' mercure.rocks cdn.jsdelivr.net"],"Content-Type":["text/plain; charset=utf-8"],"Server":["Caddy"],"Alt-Svc":["h3=":443"; ma=2592000,h3-29=":443"; ma=2592000"],"X-Frame-Options":["DENY"],"X-Content-Type-Options":["nosniff"]}}

If it was only a trust certificate issue, it will be ok, but I can’t work on my website without access to my PWA ! I’m not comfortable with Caddy, so if someone have any workaround, I’ll be glad to try it.

Source: Windows Questions

LEAVE A COMMENT