谁能帮忙解决 googlevideo 下的视频反代问题?

2015-10-25 18:35:44 +08:00
 wico77

目前使用的是 nginx 反代,配置如下。
server {
listen 80;
server_name ~^(.+).mydomain.com$;

location / {

resolver 8.8.8.8;

 proxy_pass https://$1.googlevideo.com;
 proxy_set_header referer https://$1.googlevideo.com;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header Host $1.googlevideo.com;
 proxy_redirect off;
 proxy_set_header User-Agent $http_user_agent;

}
}

可是老跳转到 googlevideo 。反代不成功。请大家帮解决。谢谢

4240 次点击
所在节点    NGINX
23 条回复
ericFork
2015-10-25 19:10:55 +08:00
反代自己也需要 https 吧?
wu360463231
2015-10-25 22:37:04 +08:00
为何不用 sniproxy ?
jacy
2015-10-25 22:56:16 +08:00
老跳转到 googlevideo 是什么意思
这种可能需要 https 的建议还是 sniproxy
xiaozhizhu1997
2015-10-25 23:18:19 +08:00
直接 sniproxy 加 dnsmasq 策略吧
kmahyyg
2015-10-26 01:13:58 +08:00
Google 有限速,不建议反带视频。反带个 scholars 得了
wico77
2015-10-26 01:28:12 +08:00
@xiaozhizhu1997 用 sniproxy 需要两台 vps 吧。
xiaozhizhu1997
2015-10-26 07:49:44 +08:00
@wico77 如果和 Nginx 同时用 需要两个 IP
402645707
2015-10-26 20:08:34 +08:00
跳回来的主要原因是没有 subs_filter 吧
402645707
2015-10-26 20:12:01 +08:00
注意一下你后面 location 段都是 https://~~~
VPS 是在墙外就把 s 去掉吧
80 端口出入墙在 443 加密美帝本地漫游
不知道楼主怎么想的
402645707
2015-10-26 20:17:07 +08:00
好像楼主你是昨天找我要配置的,发在这自取吧
亲测可用
话说我这不停的自己打自己脸是什么节奏
==================================

server {
listen 80;
server_name ~^(.*)\.xxx\.xxxxx\.com$;
location / {
resolver 8.8.8.8;
proxy_pass https://$1.googlevideo.com;
proxy_redirect off;
proxy_set_header Accept-Encoding "";
proxy_set_header User-Agent $http_user_agent;
proxy_set_header Cookie "PREF=ID=041208f19f6de346:U=0f62f33dd8549d11:FF=2:LD=zh-CN:NW=1:TM=1325338577:LM=1332142444:GM=1:SG=2:S=rE0SyJh2W1IQ-Maw";
}
}
server {
listen 443;
server_name ~^(.*)\.xx\.xxxx\.xxx$;
ssl on;
ssl_certificate /usr/local/nginx/conf/vhost/server/xx.crt;
ssl_certificate_key /usr/local/nginx/conf/vhost/server/xx.key;

location / {
resolver 8.8.8.8;
proxy_pass https://$1.googlevideo.com;
proxy_redirect off;
proxy_set_header Accept-Encoding "";
proxy_set_header User-Agent $http_user_agent;
proxy_set_header Cookie "PREF=ID=041208f19f6de346:U=0f62f33dd8549d11:FF=2:LD=zh-CN:NW=1:TM=1325338577:LM=1332142444:GM=1:SG=2:S=rE0SyJh2W1IQ-Maw";
}
}
wico77
2015-10-26 20:55:53 +08:00
@402645707 谢谢你的配置,测试可用,不过就是首次打开浏览器老提示不安全,需要确认安全后才能打开,是因为证书的原因吗,我在 namecheap 买的证书。
402645707
2015-10-27 06:44:06 +08:00
@wico77 因为这是三级以后的域名了所以证书管不到
可以试试二级域名加 wilcard ,不过这个方法好像有点奢侈
可以试试把 googlevideo 的通配符改到某个二级域名的二级目录下
像这样
xx.xxx.xxx/snxxxxxxv / xxxxxxx
配置文件今晚我再改改看
402645707
2015-10-27 09:46:18 +08:00
把 server name 改下
xxx/.xxxx/.xxx/~(手机不好打符号注意下)$
其它不变
使用方法有变化

然后就应该可以正常的使用证书了
wico77
2015-10-27 16:46:24 +08:00
server name 应该用 xx.xxx.xxx 吧。应该找出$uri 里的类似 r12---sn-oguesnee ,然后反代。
wico77
2015-10-27 21:19:17 +08:00
@402645707 wildcard ssl 也买了。但测试不行。前两次老是跳转,第三次才会正常代理。我猜测可能跟 cookie 有关。感觉 googlevideo 很难反代
402645707
2015-10-27 21:47:02 +08:00
@wico77 跟域名后面加个点清理缓存 比如 com.
从来没有跳转过,楼主可以试试把 set cookies 删了,那个是为了可以让百度云的离线服务器拖数据才设置的,毕竟 googlevideo 的下载链子限制有点大
wico77
2015-10-28 19:46:40 +08:00
@402645707 多次测试。还是不行。老是跳转。搞不懂为什么。你的真的不跳转?给我个链接测试下?
402645707
2015-10-28 21:24:09 +08:00
@wico77 gv.mrsang.pw 替换 googlevideo.com
道歉上面的配置文件发错了 http 不加 s
402645707
2015-10-28 21:32:22 +08:00
好吧 gv 的下载链是限 ip 的所以如果你的代理服务器和反带不是一个 ip 的话。。。
的确会不停的跳。。。
subs_filter 可解
不过因为最近服务器用来给同学做分发所以没法安装
楼主可以去找一下相关的教程
wico77
2015-10-28 21:32:47 +08:00
@402645707 你的也跳呀。而且还提示证书问题。晕了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/230963

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX