mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Set OPTIONS status in setCorsHeaders()
This commit is contained in:
parent
7e0bce2d0f
commit
de6cd380eb
@ -35,6 +35,10 @@ func setCorsHeaders(ctx *context.Context, origin string) {
|
|||||||
ctx.Output.Header(headerAllowOrigin, origin)
|
ctx.Output.Header(headerAllowOrigin, origin)
|
||||||
ctx.Output.Header(headerAllowMethods, "POST, GET, OPTIONS, DELETE")
|
ctx.Output.Header(headerAllowMethods, "POST, GET, OPTIONS, DELETE")
|
||||||
ctx.Output.Header(headerAllowHeaders, "Content-Type, Authorization")
|
ctx.Output.Header(headerAllowHeaders, "Content-Type, Authorization")
|
||||||
|
|
||||||
|
if ctx.Input.Method() == "OPTIONS" {
|
||||||
|
ctx.ResponseWriter.WriteHeader(http.StatusOK)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getHostname(s string) string {
|
func getHostname(s string) string {
|
||||||
@ -89,11 +93,6 @@ func CorsFilter(ctx *context.Context) {
|
|||||||
ctx.ResponseWriter.WriteHeader(http.StatusForbidden)
|
ctx.ResponseWriter.WriteHeader(http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Input.Method() == "OPTIONS" {
|
|
||||||
ctx.ResponseWriter.WriteHeader(http.StatusOK)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user