dlundquist / sniproxy

Proxies incoming HTTP and TLS connections based on the hostname contained in the initial request of the TCP session.
BSD 2-Clause "Simplified" License
2.57k stars 398 forks source link

Formula1.com #359

Closed tuxity closed 4 years ago

tuxity commented 4 years ago

Hello,

F1TV is - according to conditions - georestricted to the country where you bought your membership. For now it actually work from outside the country, but it might be temporary.

I have configured sniproxy and bind9 on formula1.com domain and it works pretty well for all API calls and VOD. But I have an issue with live streams, I get a 403 when player tries to load .m3u8 files.

It seems they are using CloudFront for lives and somehow CF is able to detect your location and returns you a 403.

GET /live/wif0711034332/master.m3u8?nva=YYYYYYYY&ttl=86400&cc=IT&token=XXXXX HTTP/1.1
Host: f1tv-cdn-cent-live.formula1.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
Accept: */*
Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
Origin: https://f1tv.formula1.com
Connection: keep-alive
Referer: https://f1tv.formula1.com/en/current-season/styrian-grand-prix/2020-styrian-grand-prix-formula-1-qualifying
Cookie: sailthru_hid=WWWWWWWW

HTTP/2 403 Forbidden
server: CloudFront
date: Sat, 11 Jul 2020 14:22:58 GMT
content-type: text/html
content-length: 919
x-cache: Error from cloudfront
via: 1.1 b74a7a3f7ddfd685212e870d027c332d.cloudfront.net (CloudFront)
x-amz-cf-pop: FRA53
x-amz-cf-id: WkAsONXm8I5R0Ap7Z9XvwGAZ4MBiKKcxctB3ErZzeBYUHrCQbxg7gA==
X-Firefox-Spdy: h2

Do you have an idea if it's something I can fix with sniproxy? Maybe CORS issue?

EDIT: Found CF GeoRestriction feature documentation https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/georestrictions.html maybe if I add domain cloudfront.net to sniproxy it can work.

tuxity commented 4 years ago

Tested with a VM and local ISP IP and it's working, my server provider IP is blocked by CloudFront. Nothing to do with sniproxy :)