mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-06 20:10:11 +02:00
fix(publicip/api/cloudflare): add Referer header (#3058)
This commit is contained in:
@@ -40,7 +40,8 @@ func (c *cloudflare) Token() (token string) {
|
||||
func (c *cloudflare) FetchInfo(ctx context.Context, ip netip.Addr) (
|
||||
result models.PublicIP, err error,
|
||||
) {
|
||||
url := "https://speed.cloudflare.com/meta"
|
||||
urlBase := "https://speed.cloudflare.com"
|
||||
url := urlBase + "/meta"
|
||||
if ip.IsValid() {
|
||||
return result, fmt.Errorf("%w: cloudflare cannot provide information on the arbitrary IP address %s",
|
||||
ErrServiceLimited, ip)
|
||||
@@ -50,6 +51,7 @@ func (c *cloudflare) FetchInfo(ctx context.Context, ip netip.Addr) (
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
request.Header.Add("Referer", urlBase) // returns HTTP 403 otherwise
|
||||
|
||||
response, err := c.client.Do(request)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user