Last active
December 14, 2016 14:31
-
-
Save neilgaietto/5cdf8237d9f55667356cf0a768b8057d to your computer and use it in GitHub Desktop.
Mock "CloudFront-Viewer-Country" via Fiddler2
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
// Snippet of what needs added to the Fiddler2 script to add a fake CloudFront-Viewer-Country value on all requests. | |
// The "..."'s indicate hidden code to highlight what needs added. | |
// This is for testing locally. | |
class Handlers | |
{ | |
... | |
// Create CloudFront-Viewer-Country header setting in "Rules" main nav | |
RulesString("CloudFront-Viewer-Country", true) | |
RulesStringValue(0, "US", "US") | |
RulesStringValue(1, "Canada", "CA") | |
RulesStringValue(2, "Mexico", "MX") | |
RulesStringValue(3, "United Kingdom", "GB") | |
RulesStringValue(4, "Greece", "GR") | |
public static var sCFCountry: String = null; | |
... | |
static function OnBeforeRequest(oSession: Session) { | |
... | |
//check for cloud front country header and add it to the request | |
if (null != sCFCountry) { | |
oSession.oRequest["CloudFront-Viewer-Country"] = sCFCountry; | |
oSession.oRequest["Fake-Viewer-Country"] = sCFCountry;//optional way to override cloudfront on prod | |
} | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment