I cannot use top level domain

Hi, I need help please, if I will use the top-level domain. ex: mysite.online it will not work I will get an error.If I remove the top-level domain and use only the subdomain ex: api.mysite.online it will work my api application will be accessible. I read the logs but I cannot understand what’s going on.

Note:

The mysite.online is not my real domain I just fake it just to post here my problem, but I have a real domain name and subdomain.

Here is the log

caddy-breeze        | {"level":"error","ts":1718548779.3534966,"logger":"http.log.error","msg":"dial tcp: lookup myimage1_container: i/o timeout","request":{"remote_ip":"xxx.xx.xxx.xxx","remote_port":"1921","client_ip":"xxx.xx.xxx.xxx","proto":"HTTP/2.0","method":"GET","host":"api.mysite.online","uri":"/","headers":{"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Cookie":["REDACTED"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Site":["none"],"Te":["trailers"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.5"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"],"Priority":["u=1"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.mysite.online"}},"duration":33.80618475,"status":502,"err_id":"ta34cy821","err_trace":"reverseproxy.statusError (reverseproxy.go:1269)"}
caddy-breeze        | {"level":"error","ts":1718548888.7762299,"logger":"http.log.error","msg":"dial tcp: lookup myimage1_container: i/o timeout","request":{"remote_ip":"xxx.xx.xxx.xxx","remote_port":"1921","client_ip":"xxx.xx.xxx.xxx","proto":"HTTP/2.0","method":"GET","host":"api.mysite.online","uri":"/","headers":{"Cookie":["REDACTED"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"],"Te":["trailers"],"Accept-Language":["en-US,en;q=0.5"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Upgrade-Insecure-Requests":["1"],"Priority":["u=1"],"User-Agent":["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"api.mysite.online"}},"duration":50.742522902,"status":502,"err_id":"8syrhu9w7","err_trace":"reverseproxy.statusError (reverseproxy.go:1269)"}


docker-compose

  caddy:
    image: caddy:2.8.4
    container_name: caddy-breeze
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - caddy_data:/data
      - caddy_config:/config
      - ./Caddyfile:/etc/caddy/Caddyfile
    networks:
      - mynetwork

  php:
    container_name: myimage1_container
    image: myusername/myimage1:latest
    volumes:
      - caddy_data:/data
      - caddy_config:/config
    entrypoint: php artisan octane:frankenphp --host=api.mysite.online --https --max-requests=1000
    env_file:
      - ./.env
    networks:
      - mynetwork

  php2:
    container_name: myimage2_container
    image: myusername/myimage2:latest
    ports:
      - "5173:5173"
    volumes:
      - caddy_data:/data
      - caddy_config:/config
      
      - node_modules:/app/node_modules
      - vendor:/app/vendor
    entrypoint: php artisan octane:frankenphp --host=mysite-oi.online --https --max-requests=1000

    networks:
      - mynetwork
	  

Caddyfile

	  
mysite.online {
    reverse_proxy myimage2_container:8000
}
api.mysite.online {
    reverse_proxy myimage1_container:8000
}

Thank you in advance.

This is saying Caddy wasn’t able to connect to that container. Are you sure Octane is listening on port 8000 in those containers?

How are you building the Docker images for those containers? What does the config for those containers look like?

1 Like

Hi,

Thank you it works now

What was the fix? You edited your post a couple times so it would be helpful for others to know what you did in the end.

1 Like

Hi,

What I did is I deleted the build folder inside my Laravel public folder then I rebuilt again my images. and it works.

1 Like

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