Skip to content

Instantly share code, notes, and snippets.

@baybatu
Last active September 17, 2020 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baybatu/cdda39eb9dcd51814375a475e848724f to your computer and use it in GitHub Desktop.
Save baybatu/cdda39eb9dcd51814375a475e848724f to your computer and use it in GitHub Desktop.
Netscaler CORS configuration policy for multiple domains with their subdomains
add policy patset CORS_origins_allowed
bind policy patset CORS_origins_allowed .validdomain1.com -index 1
bind policy patset CORS_origins_allowed .validdomain2.com -index 2
add responder action CORS_deny_response respondwith q{"HTTP/1.0 401 Unauthorized CORS\r\n\r\n"} -bypassSafetyCheck YES
add responder policy CORS_origin_denied `!(HTTP.REQ.HEADER("Origin").EXISTS && HTTP.REQ.HEADER("Origin").TYPECAST_HTTP_URL_T.HOSTNAME.CONTAINS_ANY("CORS_origins_allowed"))` CORS_deny_response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment