1
cnly1987 2015-07-03 19:55:24 +08:00 via Android
用ssl吧。
|
2
wico77 2015-07-03 19:56:16 +08:00
|
5
wico77 2015-07-03 20:10:44 +08:00
要用SSL
|
6
yeyeye 2015-07-03 20:18:54 +08:00
你没带上cookie当然会跳转
|
8
Orzzzz 2015-07-03 22:33:34 +08:00
|
9
ltm 2015-07-03 22:51:33 +08:00
@Orzzzz 但是Cookie是哪里来的呢?
我这样尝试过,用curl请求google,获取cookie,再用curl 带刚获取的cookie请求,google返回错误界面。 |
11
ivito OP @ltm server {
listen 443; server_name g.mydomain.com; ssl on; ssl_certificate /ssl/g.mydomain.com.crt; ssl_certificate_key /ssl/g.mydomain.com.key; location / { proxy_cookie_domain www.google.com $host; sub_filter www.google.com $host; sub_filter_once off; proxy_pass http://google; proxy_redirect https://www.google.com/ /; proxy_set_header HOST "www.google.com"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Accept-Encoding ""; proxy_set_header User-Agent $http_user_agent; proxy_set_header Accept-Language "zh-CN"; proxy_set_header Cookie "PREF=ID=047818f19f6de346:U=0f622f33dd8549d11:FF=25:LD=zh-CN:NW=1:TM=1325238577:LM=1332342444:GM=5:SG=1:S=rE01SyJh2w1IQ-Maw"; } } 参照博客内容配置如上,依然不可以,依然返回301 |
12
Orzzzz 2015-07-04 00:07:35 +08:00
@ltm head 里面set的cookie啊,你本地curl的cookie好像有问题,具体我也说不上,那个博客里面的cookie是好的,你可以试一下那里面设置的cookie,语言啊啥的都能调
|
15
hiboshi 2015-07-04 08:50:18 +08:00
log_format g.yh.gs '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; server { listen 443; server_name g.yh.gs; #rewrite ^/(.*) https://$server_name$1 permanent; ssl on; ssl_certificate /usr/local/nginx/ssl/1_g.yh.gs_bundle.crt; ssl_certificate_key /usr/local/nginx/ssl/2_g.yh.gs.key; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; # ssl_prefer_server_ciphers on; #listen 80; location / { proxy_redirect off; proxy_cookie_domain google.com xxx.xxx; proxy_pass https://www.google.co.jp/; proxy_set_header Accept-Encoding ""; proxy_set_header User-Agent $http_user_agent; proxy_set_header Accept-Language "zh-CN"; proxy_set_header Cookie "PREF=ID=047808f19f6de346:U=0f62f33dd8549d11:FF=2:LD=zh-CN:NW=1:TM=1325338577:LM=1332142444:GM=1:SG=2:S=rE0SyJh2W1IQ-Maw"; } } server { listen 80; server_name g.yh.gs; rewrite ^(.*) https://$server_name$1 permanent; } 参考我的 |
19
hambut 2015-07-04 15:37:02 +08:00
ngx_http_google_filter_module
google on; google_scholar on; google_language zh-CN; 说这么多应该够了,嗯。。 |