caddyserver / cache-handler

Distributed HTTP caching module for Caddy
Apache License 2.0
262 stars 19 forks source link

Reverse proxy site unavailable #98

Open delanym opened 1 week ago

delanym commented 1 week ago

With Caddyfile

{
        admin off
        auto_https off
        cache

        servers {
                metrics
        }
}

:80 {
        request_body 1GB
        encode zstd gzip
        cache

        reverse_proxy redmine:3000

        handle_errors {
                respond "{err.status_code} {err.status_text}"
        }
}

And compose service

  caddy:                        
    build:                                                      
      dockerfile_inline: |                            
        FROM caddy:builder AS builder                                                                                          
        RUN xcaddy build \
          --with github.com/caddyserver/cache-handler
        FROM caddy:alpine
        COPY --from=builder /usr/bin/caddy /usr/bin/caddy    
    depends_on:                                                                                                                
      - redmine        
    restart: unless-stopped
    ports:       
      - ${REDMINE_HOST}:80:80
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile

I get these errors

caddy-1 | {"level":"warn","ts":1725609062.2870831,"logger":"http.handlers.cache","msg":"caddyhttp.HandlerError{Err:reverseproxy.DialError{error:(net.OpError)(0xc000846870)}, StatusCode:502, ID:\"vaixxkaiz\", Trace:\"reverseproxy.statusError (reversepro xy.go:1269)\"}"}
caddy-1 | {"level":"warn","ts":1725609067.1568701,"logger":"http.handlers.cache","msg":"caddyhttp.HandlerError{Err:reverseproxy.DialError{error:(
net.OpError)(0xc000c94a00)}, StatusCode:502, ID:\"ypsmvi8p4\", Trace:\"reverseproxy.statusError (reversepro xy.go:1269)\"}"}
caddy-1 | {"level":"warn","ts":1725609067.300004,"logger":"http.handlers.cache","msg":"caddyhttp.HandlerError{Err:reverseproxy.DialError{error:(*net.OpError)(0xc0008469b0)}, StatusCode:502, ID:\"1j0uqziip\", Trace:\"reverseproxy.statusError (reverseprox y.go:1269)\"}"}

The log level is warn but the site becomes unavailable.

I copied the configuration from my other site running a Java application and caching no problem, so I'm assuming its an issue with the underlying application?

darkweak commented 1 week ago

Hello, is it really related to the cache-handler module? Is your redmine service up and reachable from your caddy service? (same network, running, ...)