Random 502 Bad Gateway error


(Mike Deglau) #1

I have an alexa skill that is running locally. I have caddy routing the request to the service. But I get random 502 bad gateways, and I’m not sure what to do to fix it.

This is in the log file:

72.21.217.112 - - [11/May/2018:09:00:58 -0700] "POST /assistant/alexa HTTP/1.1" 502 16
72.21.217.137 - - [11/May/2018:09:03:29 -0700] "POST /assistant/alexa HTTP/1.1" 200 103
72.21.217.82 - - [11/May/2018:09:03:52 -0700] "POST /assistant/alexa HTTP/1.1" 200 103
72.21.217.114 - - [11/May/2018:09:04:23 -0700] "POST /assistant/alexa HTTP/1.1" 200 103
72.21.217.65 - - [11/May/2018:09:06:32 -0700] "POST /assistant/alexa HTTP/1.1" 200 103
72.21.217.130 - - [11/May/2018:09:06:40 -0700] "POST /assistant/alexa HTTP/1.1" 200 103
72.21.217.74 - - [11/May/2018:09:06:58 -0700] "POST /assistant/alexa HTTP/1.1" 200 103
72.21.217.73 - - [11/May/2018:09:07:05 -0700] "POST /assistant/alexa HTTP/1.1" 200 103
72.21.217.152 - - [11/May/2018:09:07:37 -0700] "POST /assistant/alexa HTTP/1.1" 502 16

This is the error file

11/May/2018:09:07:37 -0700 [ERROR 502 /assistant/alexa] context canceled 

I see this error in the caddy log frequently, but the time doesn’t line up with the requests.
2018/05/11 09:00:41 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>

This is the Caddfile

    proxy / ###.###.#.#:8123 {
        websocket
        transparent
    }

    proxy /assistant/alexa localhost:1880/amazon-echo {
        transparent
        websocket
        without /assistant/alexa
    }
    log /home/.caddy/hassio.log {
        rotate_size 50
        rotate_age 7
        rotate_keep 4
    }
    errors /home/.caddy/hassio-error.log
}