Skip to content

Content-Type is lost after TCP_REFRESH_HIT/200 of cached response with duplicated headers from origin #11784

Description

@lukenowak

Initially the backend replies with response like:

HTTP/1.1 200 OK
Date: Mon, 23 Sep 2024 14:22:14 GMT
X-Reveal-Duplicate: same
Cache-Control: max-age=30, stale-if-error=604800, stale-while-revalidate=15, public
Content-Length: 14475
Content-Type: application/javascript
Expires: Mon, 23 Sep 2024 14:22:44 GMT
Last-Modified: Mon, 23 Sep 2024 14:22:14 GMT
X-Reveal-Duplicate: other

For the TCP_MISS/200 trafficserver query, the reply from traffic server has all expected headers:

HTTP/1.1 200 OK                                                                                                                                      
Date: Mon, 23 Sep 2024 14:22:14 GMT
X-Reveal-Duplicate: same
Cache-Control: max-age=30, stale-if-error=604800, stale-while-revalidate=15, public
Content-Length: 14475
Content-Type: application/javascript
Expires: Mon, 23 Sep 2024 14:22:44 GMT
Last-Modified: Mon, 23 Sep 2024 14:22:14 GMT
X-Reveal-Duplicate: other
Age: 0

All queries until max-age is reached are the same and correct.

After the max-age time passes trafficserver is doing TCP_REFRESH_HIT/200 to the backend with If-Modified-Since, which replies:

HTTP/1.1 304 Not Modified
Date: Mon, 23 Sep 2024 14:25:16 GMT
X-Reveal-Duplicate: same
Cache-Control: max-age=30, stale-if-error=604800, stale-while-revalidate=15, public
Content-Type: application/javascript
Expires: Mon, 23 Sep 2024 14:25:46 GMT
Last-Modified: Mon, 23 Sep 2024 14:25:16 GMT
X-Reveal-Duplicate: other

But then the Trafficserver replies to the client with headers:

HTTP/1.1 200 OK
Date: Mon, 23 Sep 2024 14:25:16 GMT
Content-length: 14475
X-Reveal-Duplicate: same
Cache-Control: max-age=30, stale-if-error=604800, stale-while-revalidate=15, public
Expires: Mon, 23 Sep 2024 14:25:46 GMT
Last-Modified: Mon, 23 Sep 2024 14:25:16 GMT
X-Reveal-Duplicate: other
Age: 0

Please see, that it replies without Content-Type header, which can be seen also in the squid.log, as the line is logged like:

1727101089.801 2 127.0.0.1 TCP_REFRESH_HIT/200 14933 GET http://example.com - DIRECT/127.0.0.1 -
When the duplicated header X-Reveal-Duplicate has the same value, it results with same problem not transmitting Content-Type.

When the backend replies instead with 200 response to the If-Modified-Since then the Content-Type header is correctly transmitted.

Seems like dropping the Content-Type header there is a bug.

Reproduced on trafficserver 9.2.5, configure options:

  --with-openssl=provided-openssl
  --with-pcre=provided-pcre
  --with-ncurses=provided-ncurses
  --with-tcl=provided-tcl
  --with-luajit=provided-luajit
  --with-lzma=provided-xzutils
  --with-zlib=provided-zlib
  --disable-curl
  --disable-hwloc
  --enable-experimental-plugins
  --disable-posix-cap

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions