UNPKG

akamai-nginx

Version:

generate nginx config from akamai property

699 lines 22 kB
{ "accountId" : "act_ABD-DEF", "contractId" : "ctr_A-BCDEF", "groupId" : "grp_999999", "propertyId" : "prp_999999", "propertyName" : "akamai.com", "propertyVersion" : 1, "etag" : "1209837128730127781270387102837189273908", "rules" : { "name" : "default", "children" : [ { "name" : "HTTP/2", "children" : [ { "name" : "Redirect to HTTPS", "children" : [ ], "behaviors" : [ { "name" : "redirect", "options" : { "queryString" : "APPEND", "responseCode" : 301, "destinationHostname" : "SAME_AS_REQUEST", "destinationPath" : "SAME_AS_REQUEST", "destinationProtocol" : "HTTPS", "mobileDefaultChoice" : "DEFAULT" } } ], "criteria" : [ { "name" : "requestProtocol", "options" : { "value" : "HTTP" } } ], "criteriaMustSatisfy" : "all", "comments" : "Redirect to the same URL on HTTPS protocol, issuing a 301 response code (Moved Permanently). You may change the response code to 302 if needed." }, { "name" : "HSTS - HTTP Strict Transport Security", "children" : [ ], "behaviors" : [ { "name" : "modifyOutgoingResponseHeader", "options" : { "action" : "MODIFY", "standardModifyHeaderName" : "OTHER", "customHeaderName" : "Strict-Transport-Security", "newHeaderValue" : "max-age=31536000", "avoidDuplicateHeaders" : true } } ], "criteria" : [ ], "criteriaMustSatisfy" : "all", "comments" : "" } ], "behaviors" : [ { "name" : "http2", "options" : { "enabled" : "" } }, { "name" : "allowTransferEncoding", "options" : { "enabled" : true } } ], "criteria" : [ { "name" : "hostname", "options" : { "matchOperator" : "IS_ONE_OF", "values" : [ "http2-akamai.com" ] } } ], "criteriaMustSatisfy" : "all", "comments" : "" }, { "name" : "Security", "children" : [ { "name" : "IP Restrictions", "children" : [ { "name" : "Whitelist ips", "children" : [ ], "behaviors" : [ { "name" : "denyAccess", "options" : { "reason" : "deny-by-ip", "enabled" : false } } ], "criteria" : [ { "name" : "clientIp", "options" : { "matchOperator" : "IS_ONE_OF", "values" : [ "12.12.12.0/21", "4.4.4.4" ], "useHeaders" : false } } ], "criteriaMustSatisfy" : "all", "comments" : "3rd party" }, { "name" : "Staging", "children" : [ { "name" : "Customer IPs", "children" : [ ], "behaviors" : [ { "name" : "denyAccess", "options" : { "reason" : "deny-by-ip", "enabled" : false } } ], "criteria" : [ { "name" : "clientIp", "options" : { "matchOperator" : "IS_ONE_OF", "values" : [ "34.34.34.0/21", "7.7.7.7" ], "useHeaders" : false } } ], "criteriaMustSatisfy" : "all", "comments" : "" } ], "behaviors" : [ { "name" : "denyAccess", "options" : { "reason" : "deny-by-ip", "enabled" : true } } ], "criteria" : [ { "name" : "hostname", "options" : { "matchOperator" : "IS_ONE_OF", "values" : [ "staging-akamai.com" ] } } ], "criteriaMustSatisfy" : "all", "comments" : "change this to allow for nonprod" } ], "behaviors" : [ { "name" : "denyAccess", "options" : { "reason" : "deny-by-ip", "enabled" : true } } ], "criteria" : [ ], "criteriaMustSatisfy" : "all", "comments" : "change this to allow by default for prod configs" }, { "name" : "URL Restrictions", "children" : [ { "name" : "/server-status", "children" : [ ], "behaviors" : [ { "name" : "denyAccess", "options" : { "reason" : "default-deny-reason", "enabled" : true } } ], "criteria" : [ { "name" : "path", "options" : { "matchOperator" : "MATCHES_ONE_OF", "values" : [ "/server-status" ], "matchCaseSensitive" : false } } ], "criteriaMustSatisfy" : "all", "comments" : "Block access to the apache status page." } ], "behaviors" : [ ], "criteria" : [ ], "criteriaMustSatisfy" : "all", "comments" : "Place any URL blocking here." } ], "behaviors" : [ { "name" : "siteShield", "options" : { "ssmap" : { "value" : "s999.akamaiedge.net", "srmap" : "MAP.akasrg.akamai.com", "src" : "PREVIOUS_MAP", "name" : "MAP (s999.akamaiedge.net)" } } }, { "name" : "webApplicationFirewall", "options" : { "firewallConfiguration" : { "configId" : 9999, "productionStatus" : "Active", "productionVersion" : 22, "stagingStatus" : "Active", "stagingVersion" : 22, "fileName" : "waf_portal_9999.xml" } } } ], "criteria" : [ ], "criteriaMustSatisfy" : "all", "uuid" : "deadbeef-dead-beef-dead-deadbeef1234", "comments" : "" }, { "name" : "Performance", "children" : [ { "name" : "Compressible Objects", "children" : [ ], "behaviors" : [ { "name" : "gzipResponse", "options" : { "behavior" : "ALWAYS" } } ], "criteria" : [ { "name" : "contentType", "options" : { "matchOperator" : "IS_ONE_OF", "values" : [ "text/html*", "text/css*", "application/x-javascript*", "text/javascript*" ], "matchWildcard" : true, "matchCaseSensitive" : false } } ], "criteriaMustSatisfy" : "all", "comments" : "Compresses content to improve performance of clients with slow connections. Applies Last Mile Acceleration to requests when the returned object supports gzip compression." } ], "behaviors" : [ { "name" : "prefetch", "options" : { "enabled" : true } }, { "name" : "dnsAsyncRefresh", "options" : { "enabled" : true, "timeout" : "2h" } }, { "name" : "dnsPrefresh", "options" : { "enabled" : true, "delay" : "5m", "timeout" : "2h" }, "uuid" : "deadbeef-dead-beef-dead-deadbeef1234" } ], "uuid" : "deadbeef-dead-beef-dead-deadbeef1234", "criteria" : [ ], "criteriaMustSatisfy" : "all", "comments" : "sureroute conf." }, { "name" : "Request modification", "children" : [ { "name" : "URL upstream", "children" : [ ], "behaviors" : [ { "name" : "rewriteUrl", "options" : { "behavior" : "REPLACE", "keepQueryString" : true, "match" : "/path/", "targetPath" : "/replacement/", "matchMultiple" : true } }, { "name" : "removeQueryParameter", "options" : { "parameters" : [ "anotherquery" ] } } ], "criteria" : [ { "name" : "path", "options" : { "matchOperator" : "MATCHES_ONE_OF", "values" : [ "/test/path/one", "/*/path/two/*" ], "matchCaseSensitive" : false } }, { "name" : "queryStringParameter", "options" : { "parameterName" : "myquery", "matchOperator" : "IS_ONE_OF", "matchWildcardName" : false, "matchCaseSensitiveName" : true, "values" : [ "abc", "def" ], "matchWildcardValue" : false, "matchCaseSensitiveValue" : true, "escapeValue" : false } } ], "criteriaMustSatisfy" : "any" }, { "name" : "Header upstream", "children" : [ ], "behaviors" : [ { "name" : "modifyOutgoingRequestHeader", "options" : { "action" : "MODIFY", "standardModifyHeaderName" : "OTHER", "newHeaderValue" : "replaced-header", "avoidDuplicateHeaders" : true, "customHeaderName" : "x-testing" } }, { "name" : "modifyOutgoingRequestHeader", "options" : { "action" : "ADD", "standardAddHeaderName" : "OTHER", "headerValue" : "cond-header", "customHeaderName" : "x-another-conditional" } }, { "name" : "modifyIncomingRequestHeader", "options" : { "action" : "MODIFY", "standardModifyHeaderName" : "OTHER", "newHeaderValue" : "something-else-too", "avoidDuplicateHeaders" : true, "customHeaderName" : "x-somethingelse" } } ], "criteria" : [ { "name" : "requestHeader", "options" : { "headerName" : "x-testing", "matchOperator" : "IS_ONE_OF", "values" : [ "testvalue", "testing2" ], "matchWildcardName" : false, "matchWildcardValue" : false, "matchCaseSensitiveValue" : true } }, { "name" : "requestCookie", "options" : { "cookieName" : "mycookie", "matchOperator" : "IS", "value" : "cookieval", "matchWildcardName" : false, "matchCaseSensitiveName" : true, "matchWildcardValue" : false, "matchCaseSensitiveValue" : true } } ], "criteriaMustSatisfy" : "any" } ], "behaviors" : [ ], "criteria" : [ ], "criteriaMustSatisfy" : "all" }, { "name" : "Response modification", "children" : [ { "name" : "Header downstream", "children" : [ ], "behaviors" : [ { "name" : "modifyIncomingResponseHeader", "options" : { "action" : "MODIFY", "standardModifyHeaderName" : "OTHER", "newHeaderValue" : "xyz", "avoidDuplicateHeaders" : false, "customHeaderName" : "x-origin-response" } }, { "name" : "modifyOutgoingResponseHeader", "options" : { "action" : "MODIFY", "standardModifyHeaderName" : "ACCESS_CONTROL_ALLOW_ORIGIN", "newHeaderValue" : "*", "avoidDuplicateHeaders" : true } } ], "criteria" : [ { "name" : "path", "options" : { "matchOperator" : "MATCHES_ONE_OF", "values" : [ "/headerdownstream" ], "matchCaseSensitive" : false } }, { "name" : "requestMethod", "options" : { "matchOperator" : "IS", "value" : "GET" } } ], "criteriaMustSatisfy" : "all" }, { "name" : "Redirects", "children" : [ { "name" : "Redirect By Path", "children" : [ ], "behaviors" : [ { "name" : "redirect", "options" : { "mobileDefaultChoice" : "DEFAULT", "destinationProtocol" : "SAME_AS_REQUEST", "destinationHostname" : "OTHER", "destinationPath" : "OTHER", "queryString" : "APPEND", "responseCode" : 302, "destinationPathOther" : "/redirect-destination", "destinationHostnameOther" : "some-host-akamai.com" } } ], "criteria" : [ { "name" : "path", "options" : { "matchOperator" : "MATCHES_ONE_OF", "values" : [ "/redirect-test" ], "matchCaseSensitive" : false } } ], "criteriaMustSatisfy" : "all" }, { "name" : "Redirect By Cookie", "children" : [ ], "behaviors" : [ { "name" : "redirect", "options" : { "mobileDefaultChoice" : "DEFAULT", "destinationProtocol" : "SAME_AS_REQUEST", "destinationHostname" : "SAME_AS_REQUEST", "destinationPath" : "OTHER", "queryString" : "APPEND", "responseCode" : 302, "destinationPathOther" : "/redirected-by-cookie" } } ], "criteria" : [ { "name" : "requestCookie", "options" : { "cookieName" : "usertype", "matchOperator" : "IS", "value" : "redirectedUser", "matchWildcardName" : false, "matchCaseSensitiveName" : true, "matchWildcardValue" : false, "matchCaseSensitiveValue" : true } } ], "criteriaMustSatisfy" : "all" } ], "behaviors" : [ ], "criteria" : [ ], "criteriaMustSatisfy" : "all" } ], "behaviors" : [ ], "criteria" : [ ], "criteriaMustSatisfy" : "all" }, { "name" : "Offload", "children" : [ { "name" : "Static Objects", "children" : [ ], "behaviors" : [ { "name" : "caching", "options" : { "behavior" : "MAX_AGE", "mustRevalidate" : false, "ttl" : "2h" } }, { "name" : "prefetch", "options" : { "enabled" : true } }, { "name" : "prefetchable", "options" : { "enabled" : true } } ], "criteria" : [ { "name" : "fileExtension", "options" : { "matchOperator" : "IS_ONE_OF", "values" : [ "aif", "aiff", "au", "avi", "bin", "bmp", "cab", "carb", "cct", "cdf", "class", "css", "doc", "dcr", "dtd", "exe", "flv", "gcf", "gff", "gif", "grv", "hdml", "hqx", "ico", "ini", "jpeg", "jpg", "js", "mov", "mp3", "nc", "pct", "pdf", "png", "ppc", "pws", "swa", "swf", "txt", "vbs", "w32", "wav", "wbmp", "wml", "wmlc", "wmls", "wmlsc", "xsd", "zip", "webp", "jxr", "hdp", "wdp" ], "matchCaseSensitive" : false } } ], "criteriaMustSatisfy" : "any", "comments" : "cache static objects only - dynamically generated pdfs do not have an extension as servlet just sets mimetype" }, { "name" : "Downstream Uncacheable ", "children" : [ ], "behaviors" : [ { "name" : "downstreamCache", "options" : { "behavior" : "TUNNEL_ORIGIN" } } ], "criteria" : [ { "name" : "cacheability", "options" : { "matchOperator" : "IS_NOT", "value" : "CACHEABLE" } } ], "criteriaMustSatisfy" : "any", "comments" : "Overrides the default downstream caching behavior for uncacheable object types. Instructs the edge server to pass Cache-Control and/or Expire headers from the origin to the client." }, { "name" : "Uncachable request paths", "children" : [ ], "behaviors" : [ { "name" : "caching", "options" : { "behavior" : "NO_STORE" } } ], "criteria" : [ { "name" : "path", "options" : { "matchOperator" : "MATCHES_ONE_OF", "values" : [ "/uncached/*" ], "matchCaseSensitive" : false } } ], "criteriaMustSatisfy" : "all" } ], "behaviors" : [ { "name" : "caching", "options" : { "behavior" : "MAX_AGE", "mustRevalidate" : false, "ttl" : "2h" } }, { "name" : "downstreamCache", "options" : { "behavior" : "ALLOW", "allowBehavior" : "LESSER", "sendHeaders" : "CACHE_CONTROL_AND_EXPIRES", "sendPrivate" : false } }, { "name" : "cacheError", "options" : { "enabled" : false } }, { "name" : "cacheRedirect", "options" : { "enabled" : "false" } }, { "name" : "prefreshCache", "options" : { "enabled" : true, "prefreshval" : 10 } } ], "criteria" : [ ], "criteriaMustSatisfy" : "all", "comments" : "" }, { "name" : "Site Specific Rules", "children" : [ { "name" : "othersite-akamai.com", "children" : [ ], "behaviors" : [ { "name" : "origin", "options" : { "originType" : "CUSTOMER", "hostname" : "origin.othersite-akamai-customer.com", "forwardHostHeader" : "REQUEST_HOST_HEADER", "cacheKeyHostname" : "REQUEST_HOST_HEADER", "compress" : true, "enableTrueClientIp" : true, "originCertificate" : "", "verificationMode" : "CUSTOM", "ports" : "", "httpPort" : 80, "httpsPort" : 443, "originSni" : false, "customValidCnValues" : [ "{{Origin Hostname}}", "{{Forward Host Header}}" ], "originCertsToHonor" : "CUSTOM_CERTIFICATES", "customCertificates" : [ ], "trueClientIpHeader" : "True-Client-IP", "trueClientIpClientSetting" : false } }, { "name" : "cpCode", "options" : { "value" : { "id" : 888888, "description" : "CP2 akamai.com", "products" : [ "Alta" ], "createdDate" : 1493347578000, "name" : "CP2 akamai.com" } } }, { "name" : "modifyOutgoingRequestHeader", "options" : { "action" : "MODIFY", "standardModifyHeaderName" : "OTHER", "newHeaderValue" : "another-custom-header-value", "avoidDuplicateHeaders" : true, "customHeaderName" : "x-another-custom-header" } } ], "criteria" : [ { "name" : "hostname", "options" : { "matchOperator" : "IS_ONE_OF", "values" : [ "othersite-akamai.com" ] } } ], "criteriaMustSatisfy" : "all", "comments" : "rules specific to an alternative site sharing this config" } ], "behaviors" : [ ], "criteria" : [ ], "criteriaMustSatisfy" : "all" } ], "behaviors" : [ { "name" : "origin", "options" : { "originType" : "CUSTOMER", "hostname" : "origin.akamai-customer.com", "forwardHostHeader" : "REQUEST_HOST_HEADER", "cacheKeyHostname" : "REQUEST_HOST_HEADER", "compress" : true, "enableTrueClientIp" : true, "trueClientIpHeader" : "True-Client-IP", "trueClientIpClientSetting" : false, "originCertificate" : "", "verificationMode" : "CUSTOM", "originSni" : false, "ports" : "", "httpPort" : 80, "httpsPort" : 443, "customValidCnValues" : [ "{{Origin Hostname}}", "{{Forward Host Header}}" ], "originCertsToHonor" : "STANDARD_CERTIFICATE_AUTHORITIES", "standardCertificateAuthorities" : [ "akamai-permissive" ] } }, { "name" : "cpCode", "options" : { "value" : { "id" : 999999, "description" : "CP Akamai.com", "products" : [ "Alta" ], "createdDate" : 1493346488000, "name" : "CP Akamai.com" } } }, { "name" : "allowPost", "options" : { "enabled" : false } }, { "name" : "realUserMonitoring", "options" : { "enabled" : true } }, { "name" : "report", "options" : { "logHost" : true, "logReferer" : true, "logUserAgent" : true, "logAcceptLanguage" : false, "logCookies" : "OFF", "logCustomLogField" : false } }, { "name" : "healthDetection", "options" : { "retryCount" : 3, "retryInterval" : "120s", "maximumReconnects" : 3 } }, { "name" : "dnsPrefresh", "options" : { "enabled" : true, "delay" : "5m", "timeout" : "2h" }, "uuid" : "deadbeef-dead-beef-dead-deadbeef1234" }, { "name" : "modifyOutgoingRequestHeader", "options" : { "action" : "MODIFY", "standardModifyHeaderName" : "OTHER", "newHeaderValue" : "custom-header-value", "avoidDuplicateHeaders" : true, "customHeaderName" : "x-custom-header" } } ], "uuid" : "default", "options" : { "is_secure" : true }, "variables" : [ ], "comments" : "The behaviors in the Default Rule apply to all requests for the property hostname(s) unless another rule overrides the Default Rule settings." }, "ruleFormat" : "latest", "comments" : "sample." }