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 and leninalive committed Oct 29, 2024
1 parent 4b3675b commit b6df057
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 b6df057

Please sign in to comment.