-
Notifications
You must be signed in to change notification settings - Fork 81
Document best practices when upgrading Fastly #3188
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
base: 5.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| --- | ||
| description: Recommendations for validating Fastly across development, update, and production. | ||
| month_change: yes | ||
| --- | ||
|
|
||
| # Best practices for testing and updating Fastly | ||
|
|
||
| You can use Fastly in caching, performance, and request handling in [[= product_name =]] on-premise environments. | ||
| However, it also introduces a dependency layer that can surface issues that impact authentication and caching behavior only in environments where it is enabled. | ||
|
Check notice on line 9 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
|
|
||
| Usually, Fastly isn't used during development, which means configuration or behavior mismatches are often discovered during staging or production rollout. | ||
| To avoid production issues, ensure that you include Fastly in development and staging workflows, and validate configuration changes thoroughly before moving to production. | ||
|
|
||
| This guide explains how to: | ||
|
|
||
| - Use Fastly safely during development and testing. | ||
| - Upgrade Fastly configuration for [[= product_name =]] v5.0. | ||
| - Identify and avoid common pitfalls. | ||
| - Validate your setup before going to production. | ||
|
|
||
| For detailed configuration steps, VCL structure, and CLI usage, [Configure and customize Fastly](https://doc.ibexa.co/en/5.0/infrastructure_and_maintenance/cache/http_cache/fastly/#configure-and-customize-fastly). | ||
|
|
||
| ## Use Fastly during development and testing | ||
|
|
||
| Fastly behaves as an application layer in front of [[= product_name =]]. | ||
| Because of this, caching rules, cookie handling, authentication flows may behave differently compared to a direct origin setup. | ||
|
|
||
| Introducing Fastly only in production may cause issues to surface at a late stage. | ||
|
|
||
| ### Recommended testing approaches | ||
|
|
||
| Depending on your infrastructure, you can: | ||
|
|
||
| - Use a dedicated Fastly service for non-production environments. | ||
| - Connect staging environments to a controlled Fastly configuration. | ||
| - Use DDEV-based setups when applicable. | ||
|
|
||
| For DDEV integration setup details, see [Fastly integration with DDEV environments](https://doc.ibexa.co/en/5.0/infrastructure_and_maintenance/clustering/clustering_with_ddev/#fastly). | ||
|
|
||
| #### What to validate early | ||
|
|
||
| When you enable Fastly in non-production environments, focus on testing the core authentication and caching behaviors, as outlined in the [Pre-production checklist](#preproduction-checklist) to identify configuration mismatches before they reach the staging phase. | ||
|
|
||
| ### Simulate Fastly in deployment | ||
|
Check notice on line 44 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
|
|
||
| Because Fastly can't be fully reproduced locally, you could use a simulation strategy to catch configuration mismatches early: | ||
|
|
||
| #### Stage 1: Local smoke testing with DDEV & Varnish | ||
|
Check notice on line 48 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
|
|
||
| Fastly is built on Varnish, therefore you could use the DDEV Varnish integration to catch raw VCL, caching header, and session cookie issues locally: | ||
|
Check notice on line 50 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
|
|
||
| 1. Enable the Varnish service in DDEV: | ||
|
|
||
| `ddev add-on get ddev/ddev-varnish` | ||
|
|
||
| 1. Use the [[= product_name =]] v5.0 Varnish VCL [base configuration](https://github.com/ibexa/http-cache/blob/v[[= latest_tag_5_0 =]]/docs/varnish/vcl/varnish7.vcl) as your local proxy. | ||
| 1. Test authentication, back office operations, and session persistence. | ||
|
|
||
| This stage helps identify low-level caching and cookie handling issues early. | ||
|
|
||
| #### Stage 2: Staging with temporary Fastly domains | ||
|
Check notice on line 61 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
|
|
||
| Before you move on to production, clone your production Fastly service to validate the infrastructure layer safely: | ||
|
|
||
| 1. Clone the service: In the Fastly UI, clone your active production service to create a temporary, test version. | ||
| 1. Reconfigure origins: Point the backend to your staging environment instead of production. | ||
| 1. Configure temporary domains: Use a temporary Fastly-provided domain, for example, `staging-yourdomain.global.ssl.fastly.net`, or a dedicated test subdomain. | ||
| 1. Run validation: Access the staging site through the Fastly URL and verify header handling, cookie behavior, session persistence, and back office functionality. | ||
|
|
||
| This stage allows you to test real Fastly behavior safely before moving to production. | ||
|
|
||
| ## Update Fastly configuration safely | ||
|
Check notice on line 72 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
|
|
||
| When you upgrade [[= product_name =]], do not reuse legacy VCL files. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should mentioned explicitly in the upgrade docs if fastly .vcl files changes ( they don't change that often ). The burden on checking if they change should be on us, not every customer IMO |
||
| Always start from the new default Fastly configuration for the target version, and carefully review your Fastly configuration customizations as you reapply them, because changes between versions may affect authentication and caching behavior. | ||
|
Check warning on line 75 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
|
|
||
| Focus on session and authentication handling, cookie-based logic, cache bypass rules, and header manipulation rules. Even small changes in these areas can affect login behavior or cache correctness. | ||
|
|
||
| ## Common Fastly issues during update | ||
|
|
||
| The following issues may appear when you use Fastly as the view cache for [[= product_name =]] and you perform an update. | ||
|
|
||
| | Issue | Symptoms | Common causes | Recommendation areas | | ||
| |------|----------|---------------|-------| | ||
| | Authentication and session issues | - Back office login fails<br>- Users are logged out unexpectedly<br>- Sessions are not persistent | - Session cookie name prefix changes break VCL rules<br>- VCL still references outdated cookie identifiers<br>- Cookie filtering removes required authentication cookies | Cookie and session handling | | ||
|
Check notice on line 85 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
| | Incorrect caching behavior | - Logged-in users see cached anonymous content<br>- Personalized content leaks between users | - Missing cache bypass rules for authenticated requests<br>- Incorrect cache key variation<br>- Cookies not properly considered in cache logic | Caching strategy + Cookie and session handling | | ||
| | Over-aggressive cache bypass | - Low cache hit ratio<br>- Unexpected cache misses | - Too many cookies forwarded to backend<br>- Broad “pass” rules triggered too often | Caching strategy | | ||
| | Environment mismatch issues | - Works in dev, fails in staging/production<br>- Issues only appear when Fastly is enabled | - Fastly not part of development setup<br>- Differences in configuration between environments | Configuration strategy | | ||
|
Check notice on line 88 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
|
|
||
| To mitigate these issues, follow these recommendations and best practices: | ||
|
|
||
| #### Cookie and session handling | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this chapter you are very specific on a problem that occurs if you don't upgrade .vcl files when upgrading from 4.6 to 5.0. And I feel the recommendations given below avoids the heart of the problem. Client needs to upgrade .vcl files.. ( they have also changed names from 4.6 to 5.0). |
||
|
|
||
| The session cookie name prefix changed from `eZSESSID{...}` in earlier versions to `IBX_SESSION_ID{...}` in v5.0, while remaining SiteAccess-specific. | ||
| This change can break VCL rules that rely on fixed cookie name patterns. | ||
|
|
||
| - Ensure required authentication cookies are not stripped. | ||
| - Validate that session cookies correctly trigger cache bypass where needed. | ||
| - Review all cookie-based conditions in VCL and update outdated cookie references. | ||
| - Avoid relying on exact cookie names. Use pattern matching where possible to reduce the impact of cookie naming changes. | ||
| - Consider temporary support for both old and new cookie identifiers during transition. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I would remove all those recommendations and instead give user a way of comparing current deployed .vcls vs the one in vendor/fastly/fastly/ Unfortunately, there is no straight way for doing that, but this doc can help. For an untrained-eye, I think user needs to create a new version in Fastly service, re-upload all the vcls and snippets to that version. Then download the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I think you may download each individally vcl using: If there is something similar for snippets too, then it should be possible to compare our distributed .vcl files vs those installed. In this conntext, user should also check that the ibexa_main.vcl file is marked as If ibexa_user_hash.vcl is marked as |
||
|
|
||
| For example: | ||
|
|
||
| ```vcl | ||
| # Old logic (hardcoded full cookie name or outdated prefix) | ||
| if (req.http.Cookie ~ "eZSESSID") { | ||
| return(pass); | ||
| } | ||
|
|
||
| # New logic (broader session detection pattern) | ||
| if (req.http.Cookie ~ "(IBX_SESSION_ID|eZSESSID)") { | ||
| return(pass); | ||
| } | ||
| ``` | ||
|
|
||
| #### Caching strategy | ||
|
|
||
| - Clearly separate anonymous cacheable content and authenticated/non-cacheable content. | ||
| - Keep caching rules explicit and minimal. | ||
| - Avoid unintended caching of personalized responses. | ||
|
|
||
| #### Configuration strategy | ||
|
|
||
| - Always base configuration on official defaults. | ||
| - Do not carry forward legacy VCL unchanged. | ||
| - Ensure you include Fastly in a non-production environment. | ||
|
|
||
| For more information about configuration management, see [List and manage Fastly configuration versions](fastly.md#list-configuration-versions). | ||
|
|
||
| ## Pre–production checklist | ||
|
|
||
| Before you deploy [[= product_name =]] with Fastly enabled in production, verify the following: | ||
|
|
||
|
Check notice on line 134 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
| - Environment validation: | ||
| - You enable Fastly in staging/pre-production. | ||
| - No Fastly-related errors appear in logs. | ||
|
|
||
|
Check notice on line 138 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
| - Fastly configuration: | ||
| - Configuration is based on v5.0 defaults. | ||
|
Check notice on line 140 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
| - You've reviewed and reapplied all the customizations. | ||
| - No outdated VCL logic remains. | ||
|
|
||
| - Authentication and sessions: | ||
| - Back office login works through Fastly. | ||
| - Session persistence behaves correctly. | ||
| - Logout invalidates sessions properly. | ||
|
|
||
|
Check notice on line 148 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
| - Caching behavior: | ||
| - Anonymous pages are cached correctly. | ||
|
Check notice on line 150 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
| - Authenticated users bypass cache where required. | ||
| - No cross-user content leakage occurs. | ||
|
|
||
|
Check notice on line 153 in docs/infrastructure_and_maintenance/cache/http_cache/best_practices_fastly.md
|
||
| - Functional validation: | ||
| - You've tested key user journeys with Fastly enabled. | ||
| - Behavior matches origin-only setup where expected. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1091,6 +1091,14 @@ Depending on your reverse proxy, you'll find them in the following directories: | |
| - Varnish: `vendor/ibexa/http-cache/docs/varnish/vcl/` | ||
| - Fastly: `vendor/ibexa/fastly/fastly/` | ||
|
|
||
| !!! note "Fastly considerations" | ||
|
|
||
| Version updates may introduce changes (for example, to cookies or caching behavior) that could require modifications in Fastly/VCL configuration. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no "may introduce changes" here. We know for a fact that there are changes. User must update vcl configuration. Only reviewing them is not enough |
||
|
|
||
| If you are using Fastly, review your configuration carefully during the update. | ||
|
|
||
| For more information, see [Best practices for testing and updating Fastly](best_practices_fastly.md). | ||
|
|
||
| #### Ibexa Cloud | ||
|
|
||
| Generate the Ibexa Cloud Platform.sh configuration files, review the changes with your own version, and merge your customizations. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fastly UI is not available for Ibexa Cloud customers, that means 99% of our customers that uses Fastly. So not sure how applicable this is..
It should be possible to create a free account and fastly and use that, but cloning existing production is not an an option for most customers
AFAIK, all cloud customers that are entitled to Fastly, also have a staging environment where Fastly is/should be enabled. One of the ideas with this staging environment is to test for instance Fastly integration