Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fastly support #597

Merged
merged 7 commits into from Oct 10, 2023
Merged

Add Fastly support #597

merged 7 commits into from Oct 10, 2023

Conversation

DemigodCode
Copy link
Contributor

This PR adds the support for Fastly.

Please take a closer look at the .rst-files cause I wasn't able to find a working editor.

@DemigodCode DemigodCode mentioned this pull request Oct 6, 2023
@DemigodCode
Copy link
Contributor Author

Okay, that's all I think. Would be possible to split Cache-Control and Surrogate-Control, but don't know how and currently I'm configuring this using vcl.

In Fastly you can specify the Cache-Control for the cache using Surrogate-Control-Header and Cache-Control-Header to control the users browser cache.

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! this looks good - i only commented some details to tweak the doc and such.

for the documentation, can you please add the cross-linking in places it is missing?

can you please add a section for what fastly configuration to do for cache tagging and the other functionality? lets not make it a fastly tutorial, but specify the specific vcl bits for each functionality - probably quite similar to the varnish proxy configuration chapter :
https://foshttpcache.readthedocs.io/en/latest/proxy-configuration.html

user context caching could probably be made to work as well, as fastly is based on varnish and offers custom VCL. but that would need to be tested out - we can skip it for now.

Resources/doc/reference/configuration/proxy-client.rst Outdated Show resolved Hide resolved
Resources/doc/reference/configuration/proxy-client.rst Outdated Show resolved Hide resolved
Resources/doc/reference/configuration/proxy-client.rst Outdated Show resolved Hide resolved
Resources/doc/reference/configuration/proxy-client.rst Outdated Show resolved Hide resolved
src/DependencyInjection/Configuration.php Outdated Show resolved Hide resolved
src/DependencyInjection/Configuration.php Outdated Show resolved Hide resolved
src/DependencyInjection/Configuration.php Show resolved Hide resolved
src/DependencyInjection/Configuration.php Outdated Show resolved Hide resolved
src/DependencyInjection/Configuration.php Outdated Show resolved Hide resolved
@DemigodCode
Copy link
Contributor Author

Okay, did the code changes.

can you please add a section for what fastly configuration to do for cache tagging and the other functionality? lets not make it a fastly tutorial, but specify the specific vcl bits for each functionality - probably quite similar to the varnish proxy configuration chapter :
https://foshttpcache.readthedocs.io/en/latest/proxy-configuration.html

So you want me to create a PR in the FosHttpCache Repo which creates a Fastly config section?

@dbu
Copy link
Contributor

dbu commented Oct 10, 2023

So you want me to create a PR in the FosHttpCache Repo which creates a Fastly config section?

oh, sorry did not realize that i switched the repository while looking at the documentation. i created FriendsOfSymfony/FOSHttpCache#546 - if you want to work on it, please do of course, but its not in this pull request.

@dbu dbu merged commit 7bcc34f into FriendsOfSymfony:2.x Oct 10, 2023
12 checks passed
@dbu
Copy link
Contributor

dbu commented Oct 10, 2023

thanks a lot!

@dbu
Copy link
Contributor

dbu commented Oct 10, 2023

@DemigodCode
Copy link
Contributor Author

DemigodCode commented Oct 10, 2023

Will do once I've finished my integration completly and have a better understanding of fastly.

I could imagine there are more pitfalls than I know so far ;-)

E.g. Fastly uses more than one Cache-Control.

Surrogate-Control: Controls the Cache of Fastly.
Cache-Control: Fallback if no Surrogate Control is set and passed to the user. Would make sense to define both to disable the browser cache while caching in fastly, which is currently not working with FOSHttpCache.

At the moment I'm copying the Cache-Control to Surrogate-Control in vcl_fetch and set Cache-Control to "no-store".
I don't think that's something I want to do, cause for some images I want to use the browser cache and for other images not.

@dbu
Copy link
Contributor

dbu commented Oct 10, 2023

awesome, looking forward to that!

regarding surrogate-control: there is a discussion about bringing support for that directly into the symfony Response object: symfony/symfony#47288

that would be the best solution for this. it would be possible to create custom headers for it in FOSHttpCacheBundle but it would be more elegant if its in symfony itself. either way we could start implementing configuration for it in the bundle and then depending on the symfony version set a custom header or use the official header once symfony supports it.

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.

None yet

2 participants