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

Rename version header to comply with nuntius #595

Merged
merged 1 commit into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions etc/vcl_snippets/deliver.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
}

if ( fastly.ff.visits_this_service == 0 ) {
if ( req.http.Cookie:deploy_version != req.http.request_version && req.http.request_version != table.lookup(magentomodule_config, "current_version", "DEFAULT") ) {
set beresp.http.Set-Cookie:deploy_version = req.http.request_version;
if ( req.http.Cookie:deploy_version != req.http.Platformsh-Version && req.http.Platformsh-Version != table.lookup(magentomodule_config, "current_version", "DEFAULT") ) {
set beresp.http.Set-Cookie:deploy_version = req.http.Platformsh-Version;
}
# Tell the browser to delete the deploy_version cookie if the requested_version is current version
if ( req.http.Cookie:deploy_version != "" && req.http.request_version == table.lookup(magentomodule_config, "current_version", DEFAULT ) ) {
if ( req.http.Cookie:deploy_version != "" && req.http.Platformsh-Version == table.lookup(magentomodule_config, "current_version", DEFAULT ) ) {
add beresp.http.Set-Cookie = "deploy_version=DEFAULT; Expires=Wed Jun 01 2022 00:00:00 GMT";
}
}
Expand Down
2 changes: 1 addition & 1 deletion etc/vcl_snippets/hash.vcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Add support for versions of the cache depending on the blue/green model. If not specified default to DEFAULT
set req.hash += req.http.request_version;
set req.hash += req.http.Platformsh-Version;

if (req.http.graphql) {
# GraphQL should cache on X-Magento-Cache-Id if available, which has a bunch of variations so it should be part of the key and not a Vary factor
Expand Down
6 changes: 3 additions & 3 deletions etc/vcl_snippets/recv.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
&& req.http.Cookie:deploy_version != table.lookup(magentomodule_config, "next_version", "DEFAULT") ) {
# Next Version differs from Current Version. Let's roll out a percentage of traffic
if (randombool(std.atoi(table.lookup(magentomodule_config, "rollout_percentage", "0")), 100)) {
set req.http.request_version = table.lookup(magentomodule_config, "next_version");
set req.http.Platformsh-Version = table.lookup(magentomodule_config, "next_version");
}
}

# If request version has not been set by rollout percentage set to current version
if ( !req.http.request_version ) {
set req.http.request_version = table.lookup(magentomodule_config, "current_version", "DEFAULT");
if ( !req.http.Platformsh-Version ) {
set req.http.Platformsh-Version = table.lookup(magentomodule_config, "current_version", "DEFAULT");
}

# When using Magento tester to test whether your site is configured properly
Expand Down