Skip to content

Commit

Permalink
add Origin header to requests
Browse files Browse the repository at this point in the history
  • Loading branch information
ysfbsf committed Feb 21, 2025
1 parent b1dee70 commit 0efc02d
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 9 deletions.
9 changes: 7 additions & 2 deletions adapters/missena/missena.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (a *adapter) getEndPoint(ext *openrtb_ext.ExtImpMissena) (string, error) {
}

func (a *adapter) makeRequest(imp openrtb2.Imp, request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo, params *openrtb_ext.ExtImpMissena, gdprApplies bool, consentString string) (*adapters.RequestData, error) {
url, err := a.getEndPoint(params)
endpointURL, err := a.getEndPoint(params)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -169,11 +169,16 @@ func (a *adapter) makeRequest(imp openrtb2.Imp, request *openrtb2.BidRequest, re
}
if request.Site != nil {
headers.Add("Referer", request.Site.Page)
pageURL, err := url.Parse(request.Site.Page)
if err == nil {
origin := fmt.Sprintf("%s://%s", pageURL.Scheme, pageURL.Host)
headers.Add("Origin", origin)
}
}

return &adapters.RequestData{
Method: "POST",
Uri: url,
Uri: endpointURL,
Headers: headers,
Body: body,
ImpIDs: []string{imp.ID},
Expand Down
3 changes: 2 additions & 1 deletion adapters/missena/missenatest/exemplary/multiple-imps.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"Accept": ["application/json"],
"User-Agent": ["test-user-agent"],
"X-Forwarded-For": ["123.123.123.123"],
"Referer": ["https://example.com/page"]
"Referer": ["https://example.com/page"],
"Origin": ["https://example.com"]
},
"body": {
"adunit": "test-imp-id-1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"Accept": ["application/json"],
"User-Agent": ["test-user-agent"],
"X-Forwarded-For": ["2001:0000:130F:0000:0000:09C0:876A:130B"],
"Referer": ["https://example.com/page"]
"Referer": ["https://example.com/page"],
"Origin": ["https://example.com"]
},
"body": {
"adunit": "test-imp-id",
Expand Down
3 changes: 2 additions & 1 deletion adapters/missena/missenatest/exemplary/simple-banner.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"Accept": ["application/json"],
"User-Agent": ["test-user-agent"],
"X-Forwarded-For": ["123.123.123.123"],
"Referer": ["https://example.com/page"]
"Referer": ["https://example.com/page"],
"Origin": ["https://example.com"]
},
"body": {
"adunit": "test-imp-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"Accept": ["application/json"],
"User-Agent": ["test-user-agent"],
"X-Forwarded-For": ["123.123.123.123"],
"Referer": ["https://example.com/page"]
"Referer": ["https://example.com/page"],
"Origin": ["https://example.com"]
},
"body": {
"adunit": "test-imp-id-1",
Expand Down
3 changes: 2 additions & 1 deletion adapters/missena/missenatest/supplemental/status-204.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"Accept": ["application/json"],
"User-Agent": ["test-user-agent"],
"X-Forwarded-For": ["123.123.123.123"],
"Referer": ["https://example.com/page"]
"Referer": ["https://example.com/page"],
"Origin": ["https://example.com"]
},
"body": {
"adunit": "test-imp-id",
Expand Down
3 changes: 2 additions & 1 deletion adapters/missena/missenatest/supplemental/status-400.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"Accept": ["application/json"],
"User-Agent": ["test-user-agent"],
"X-Forwarded-For": ["123.123.123.123"],
"Referer": ["https://example.com/page"]
"Referer": ["https://example.com/page"],
"Origin": ["https://example.com"]
},
"body": {
"adunit": "test-imp-id",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"Accept": ["application/json"],
"User-Agent": ["test-user-agent"],
"X-Forwarded-For": ["123.123.123.123"],
"Referer": ["https://example.com/page"]
"Referer": ["https://example.com/page"],
"Origin": ["https://example.com"]
},
"body": {
"adunit": "test-imp-id",
Expand Down

0 comments on commit 0efc02d

Please sign in to comment.