SplitHTTP server: Add global CORS headers for browser dialer (#3830)

This commit is contained in:
Lumière Élevé 2024-09-20 08:55:54 +01:00 committed by GitHub
parent 93cff1a576
commit acbf36e21b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,6 +55,9 @@ func (c *Config) GetRequestHeader() http.Header {
}
func (c *Config) WriteResponseHeader(writer http.ResponseWriter) {
// CORS headers for the browser dialer
writer.Header().Set("Access-Control-Allow-Origin", "*")
writer.Header().Set("Access-Control-Allow-Methods", "GET, POST")
paddingLen := c.GetNormalizedXPaddingBytes().roll()
if paddingLen > 0 {
writer.Header().Set("X-Padding", strings.Repeat("0", int(paddingLen)))