Skip to content

Conversation

94noni
Copy link
Contributor

@94noni 94noni commented Jan 7, 2025

Hey, here is a PR after #588
Fastly needs a separator so it could be wise to state it here :) (instead of default ,)

https://www.fastly.com/documentation/reference/http/http-headers/Surrogate-Key/
Capture d’écran 2025-01-07 à 18 46 17

wdyt? thank you,


Fastly supports cache tagging out of the box.
Configure the tag header to ``Surrogate-Key``. (``fos_http_cache.tags.response_header`` if you use FOSHttpCacheBundle)
Configure the tag header to ``Surrogate-Key``. (``fos_http_cache.tags.response_header`` as well as ``fos_http_cache.tags.separator`` to `` `` if you use FOSHttpCacheBundle)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Configure the tag header to ``Surrogate-Key``. (``fos_http_cache.tags.response_header`` as well as ``fos_http_cache.tags.separator`` to `` `` if you use FOSHttpCacheBundle)
Configure the tag header to ``Surrogate-Key`` and the separator to `` `` (empty string).
If you use FOSHttpCacheBundle, this can be done in the bundle configuration:
.. code-block:: yaml
fos_http_cache:
tags:
response_header: Surrogate-Key
separator: ' '
If you do not use the bundle, you need to pass your own instance of the TagHeaderFormatter with the right options to the ResponseTagger::
use FOS\HttpCache\ResponseTagger;
use FOS\HttpCache\TagHeaderFormatter\CommaSeparatedTagHeaderFormatter;
// ...
$tagger = new ResponseTagger([
'header_formatter' => new CommaSeparatedTagHeaderFormatter('Surrogate-Key', ' '),
]);

Copy link
Contributor

@dbu dbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot! i never used fastly myself, maybe the person contributing this did not remember to document it.

i suggest we make this a bit more verbose while we are at it, to provide the full information.

@94noni
Copy link
Contributor Author

94noni commented Jan 8, 2025

I will, let me come back to this PR soon
in the mean time, may I propose this PR in the bundle FriendsOfSymfony/FOSHttpCacheBundle#638

if accepted, I will rewrite this PR to document both config when using the sf bundle

@94noni
Copy link
Contributor Author

94noni commented Jan 9, 2025

closing, I will try to open a PR to document this separator as well as the new bundle config of ttl header name

@94noni 94noni closed this Jan 9, 2025
@94noni 94noni deleted the patch-1 branch January 9, 2025 12:59
@dbu
Copy link
Contributor

dbu commented Jan 9, 2025

we could have merged this and do a separate PR for the ttl header name... but now that its closed you can also do it all in one PR :-)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants