Skip to content

Commit

Permalink
SplitHTTP server: Add global CORS headers for browser dialer (XTLS#3830)
Browse files Browse the repository at this point in the history
  • Loading branch information
PoneyClairDeLune authored Sep 20, 2024
1 parent 93cff1a commit acbf36e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions transport/internet/splithttp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit acbf36e

Please sign in to comment.