From acbf36e21b8ed2fe4f0efef17ae77a7ed1a8b3e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lumi=C3=A8re=20=C3=89lev=C3=A9?= <88174309+PoneyClairDeLune@users.noreply.github.com> Date: Fri, 20 Sep 2024 08:55:54 +0100 Subject: [PATCH] SplitHTTP server: Add global CORS headers for browser dialer (#3830) --- transport/internet/splithttp/config.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/transport/internet/splithttp/config.go b/transport/internet/splithttp/config.go index 5309b180..eb32adf7 100644 --- a/transport/internet/splithttp/config.go +++ b/transport/internet/splithttp/config.go @@ -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)))