This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream upstream_cms_old { | |
server 123.23.123.123:443; | |
} | |
upstream upstream_sap { | |
server 44.44.44.44:443; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
split_clients "${remote_addr}${http_user_agent}" $split_upstream { | |
99% upstream_cms_old; | |
* upstream_sap; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map $cookie_migration_split $chosen_upstream { | |
default $split_upstream; | |
"upstream_cms_old" "upstream_cms_old"; | |
"upstream_sap" "upstream_sap"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($deliver_upstream = 'upstream_sap') { | |
# users should stay on the new site forever | |
set $cookie_lifetime '31536000'; # 60*60*24*365 = 1 year | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# overwrite the upstream by appending "?force_upstream=oldcms" to the URL | |
map $arg_force_upstream $deliver_upstream { | |
default $chosen_upstream; | |
"oldcms" "upstream_cms_old"; | |
"sap" "upstream_sap"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_header Set-Cookie "migration_split=$deliver_upstream;Path=/;Max-Age=$cookie_lifetime;"; | |
proxy_pass https://$deliver_upstream; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map $remote_addr $bypass_ip { | |
default 0; | |
"1.111.111.111" 1; | |
} | |
map $remote_addr $bypass_ip_to_sap { | |
default 0; | |
"22.22.22.22" 1; | |
"33.33.33.33" 1; | |
"44.44.44.44" 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map $http_user_agent $bypass_user_agent { | |
default 0; | |
~*(Googlebot|bingbot|Slurp) 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.out.printf("How long is %s? Well, it's %d %n characters long of course!", "a piece of string", "a piece of string".length()); | |
/* OUTPUT: How long is a piece of string? Well, it's 17 characters long of course! */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("How long is %s? Well, it's %s characters long of course!" % ("a piece of string", len("a piece of string"))) | |
# OUTPUT: How long is a piece of string? Well, it's 17 characters long of course! |
OlderNewer