flow-development-collection icon indicating copy to clipboard operation
flow-development-collection copied to clipboard

Feature: Split HTTP Header

Open christophlehmann opened this issue 5 years ago • 2 comments

Currently only the set-cookie header is automatically split into multiple headers, see

https://github.com/neos/flow-development-collection/blob/1106fb5eae320c8aa866ca76fa6bcf4773d6ab39/Neos.Flow/Classes/Http/Helper/ResponseInformationHelper.php#L152-L155

I would be nice to have a configurable list of headers which should be splitted.

Background: I use Moc.Varnish and the header for cache tags can easily reach the maximum header length.

christophlehmann avatar Apr 03 '20 09:04 christophlehmann

Funny, how I tried to find plausible use cases for other such headers and couldn't find anything: https://github.com/guzzle/psr7/pull/299#issuecomment-580714000

Well, guess that's pretty doable to load the split headers from a setting. If you feel like it, feel free to start a PR :)

albe avatar Apr 03 '20 11:04 albe

Christopher wrote in the quoted guzzle issue:

Have a look at https://book.varnish-software.com/4.0/chapters/Cache_Invalidation.html#example-using-hashtwo-or-xkey, this is an example for a header requiring multiple instances.

The link is outdated, but webarchive.org says: https://web.archive.org/web/20200415064747/https://book.varnish-software.com/4.0/chapters/Cache_Invalidation.html#example-using-hashtwo-or-xkey

Copied from Book Varnish 4, Cache Invalidation:

Example Using Hashtwo or Xkey

  • Use case: E-commerce site
  • Same logic for hashtwo and xkey
  • HTTP response header from web page containing three products: 8155054, 166412 and 234323:
HTTP/1.1 200 OK
Server: Apache/2.2.15
X-HashTwo: 8155054
X-HashTwo: 166412
X-HashTwo: 234323
  • HTTP request header to purge pages containing product 166412:
GET / HTTP/1.1
Host: www.example.com
X-HashTwo-Purge: 166412

On an e-commerce site the backend application adds the X-HashTwo HTTP header field for every product that is included in a web page. The header for a certain page might look like the one above. If you use xkey instead of hashtwo, you should rename that header so you do not get confused.

[...]

mhsdesign avatar Jan 29 '24 22:01 mhsdesign