Add headers to look like a browser

This commit is contained in:
Fijxu 2024-10-30 03:08:24 -03:00
parent a37a1a5ff1
commit 900b6bd3e7
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4
2 changed files with 4 additions and 1 deletions

View file

@ -66,7 +66,6 @@ func videoplayback(w http.ResponseWriter, req *http.Request) {
body := []byte{0x78, 0} // protobuf body
request, err := http.NewRequest("POST", proxyURL.String(), bytes.NewReader(body))
copyHeaders(req.Header, request.Header, false)
request.Header.Set("User-Agent", ua)
if err != nil {

View file

@ -174,6 +174,10 @@ func beforeAll(next http.HandlerFunc) http.HandlerFunc {
atomic.AddInt64(&stats_.RequestCount, 1)
// To look like more like a browser
req.Header.Add("Origin", "https://www.youtube.com")
req.Header.Add("Referer", "https://www.youtube.com/")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Headers", "*")
w.Header().Set("Access-Control-Max-Age", "1728000")