dgtlmoon / dgtlmoon/changedetection.io

UI - 304 'Not Modified' cached handling causes some requests to fail, can affect reverse-proxies

Open
#2,053 40 comments 0 reactions 1 assignee Claimed by @dgtlmoon View on GitHub
upstream-bug user-interface
Dominant language
Python
Stars
34.3k
Forks
2.1k
Avg merge
22h 52m
Merged PRs (30d)
70

Description

** TLDR; ** Looks like an upstream bug that causes this, scroll to bottom

**Describe the bug**

I'm running changedetection with caddy as a reverse proxy. While the UI is perfectly usable, I am getting some errors in the browser's network tab and also in caddy's logs:

![grafik](https://github.com/dgtlmoon/changedetection.io/assets/1926175/1083a3a6-e9c8-435e-a8bc-c9177f9c67a7)

```
Dez 21 11:42:59 proliant caddy[48932]: {"level":"info","ts":1703155379.7331445,"msg":"Unsolicited response received on idle HTTP channel starting with \"0\\r\\n\\r\\n\"; err="}
Dez 21 11:43:04 proliant caddy[48932]: {"level":"info","ts":1703155384.3559086,"msg":"Unsolicited response received on idle HTTP channel starting with \"0\\r\\n\\r\\n\"; err="}
Dez 21 11:43:04 proliant caddy[48932]: {"level":"info","ts":1703155384.5456474,"msg":"Unsolicited response received on idle HTTP channel starting with \"0\\r\\n\\r\\n\"; err="}
Dez 21 11:43:04 proliant caddy[48932]: {"level":"info","ts":1703155384.5492866,"msg":"Unsolicited response received on idle HTTP channel starting with \"0\\r\\n\\r\\n\"; err="}
```

The issue seems to have been reported previously as #1977, but with little to no information on how to reproduce it or what exactly the problem is.

The error message itself comes from the go standard library used by caddy, and is an indication that the backend (in this case changedetection) is violating the HTTP spec as described in https://github.com/golang/go/issues/19895#issuecomment-292729277

I have only been able to reproduce this with the browser cache enabled. My guess is that the handling of 304 responses is the culprit here. The backend sets the `content-length: 0` header. If any content is passed anyway, this would trigger the error.

![grafik](https://github.com/dgtlmoon/changedetection.io/assets/1926175/cd1b92f4-5fa3-4f60-ac90-bcda0cad36cc)

**Version**

v0.45.9

**To Reproduce**

1. run changedetection behind caddy or traefik
2. switch between `Groups` and `Settings` with the browser cache **enabled**
3. check the network tab and the logs of the reverse proxy

**Expected behavior**

No errors.

**Desktop**
- OS: Windows 10
- Browser: Firefox
- Version: 121

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.