feat: fix CORS issue of /api/acs for SAML IdP (#3200)

* fix: fix CORS problem of /api/acs when login with saml idp

* fix: fix origin get null when receive post with http protocol
This commit is contained in:
DacongDA 2024-09-14 12:48:51 +08:00 committed by GitHub
parent 934a8947c8
commit 64491abc64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,6 +48,10 @@ func CorsFilter(ctx *context.Context) {
originHostname := getHostname(origin)
host := removePort(ctx.Request.Host)
if origin == "null" {
origin = ""
}
if strings.HasPrefix(origin, "http://localhost") || strings.HasPrefix(origin, "https://localhost") || strings.HasPrefix(origin, "http://127.0.0.1") || strings.HasPrefix(origin, "http://casdoor-app") || strings.Contains(origin, ".chromiumapp.org") {
setCorsHeaders(ctx, origin)
return