Allow CORS requests from localhost for development (#104385)

Allow CORS requests from `http://localhost:<port>`. Some webbrowsers
(like Safari) are picky about hostname vs. IP addresses, and this
makes them work well with the webapp development server.

Reviewed-on: https://projects.blender.org/studio/flamenco/pulls/104385
Reviewed-by: Sybren A. Stüvel <sybren@blender.org>
This commit is contained in:
Srivathsav-Kyatham 2025-04-24 15:23:09 +02:00 committed by Sybren A. Stüvel
parent d2bdc9690d
commit 84e4a28d6c

View File

@ -244,6 +244,7 @@ func corsOrigins(urls []url.URL) []string {
url.Host = fmt.Sprintf("%s:%d", url.Hostname(), developmentWebInterfacePort)
origins[i] = url.String()
}
origins = append(origins, fmt.Sprintf("http://localhost:%d", developmentWebInterfacePort))
log.Debug().Str("origins", strings.Join(origins, " ")).Msg("acceptable CORS origins")
return origins
}