IIS 6 reached end-of-life in 2015. It no longer receives security updates and should NOT be used in production.
Action Required: Migrate to IIS 10 or later immediately.
This documentation is maintained for legacy systems only.
IIS 6 has severe limitations that make it unsuitable for secure CORS implementations:
For secure CORS: These limitations make IIS 6 unsuitable for modern web applications requiring proper CORS security. Upgrade to IIS 7.5 or later.
Access-Control-Allow-Origin: * allows any website to access your resources. Always specify exact origins in production.
If you are absolutely required to use IIS 6 for a legacy system, follow these minimal steps:
Access-Control-Allow-Origin as the header name* as the header valueRepeat the "Add" process to configure these headers:
Access-Control-Allow-Methods, Value: GET, POST, OPTIONSAccess-Control-Allow-Headers, Value: Content-Type, AuthorizationPreflight Requests: IIS 6 cannot properly handle OPTIONS preflight requests through configuration alone. You must implement preflight handling in your application code (see below).
For those stuck on IIS 6, implement CORS at the application level for better security:
<%
' ASP Classic - Application-level CORS (IIS 6)
' Add this to the top of your ASP pages
Dim allowedOrigins, requestOrigin, i
allowedOrigins = Array("https://example.com", "https://app.example.com")
requestOrigin = Request.ServerVariables("HTTP_ORIGIN")
' Validate origin
For i = 0 To UBound(allowedOrigins)
If requestOrigin = allowedOrigins(i) Then
Response.AddHeader "Access-Control-Allow-Origin", requestOrigin
Response.AddHeader "Vary", "Origin"
Exit For
End If
Next
' Handle preflight OPTIONS request
If Request.ServerVariables("REQUEST_METHOD") = "OPTIONS" Then
Response.AddHeader "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS"
Response.AddHeader "Access-Control-Allow-Headers", "Content-Type, Authorization"
Response.AddHeader "Access-Control-Max-Age", "86400"
Response.Status = "204 No Content"
Response.End
End If
' Your application code continues...
%>
* origin (insecure)Modern IIS versions provide:
See IIS 7+ CORS documentation for modern IIS configuration.
The content on this site stays fresh thanks to help from users like you! If you have suggestions or would like to contribute, fork us on GitHub.
Save 39% on CORS in Action with promotional code hossainco at manning.com/hossain