This repository has been archived by the owner on Feb 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
twitter.conf
82 lines (76 loc) · 3.09 KB
/
twitter.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
server {
server_name {{HOST}};
listen 80;
return 301 https://{{HOST}}$request_uri;
}
server {
server_name {{HOST}};
listen 443 ssl spdy;
ssl_session_cache shared:SSL:50m;
ssl_session_timeout 5m;
ssl_certificate {{SSL_CRT}};
ssl_certificate_key {{SSL_KEY}};
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";
subs_filter_types text/html text/css text/javascript application/javascript application/json;
subs_filter "(https?:)?(\\\/\\\/|//)([^.]+?)\.twimg\.com(\\\/|/)" "https:$2{{HOST}}$4__twimg$4$3$4" r;
subs_filter "(https?:)?(\\\/\\\/|//)twitter\.com(\\\/|/)" "https:$2{{HOST}}$3" r;
subs_filter "(https?:)?(\\\/\\\/|//)mobile\.twitter\.com(\\\/|/)" "https:$2{{HOST}}$3__mobile$3" r;
subs_filter "(https?:)?(\\\/\\\/|//)t\.co(\\\/|/)" "https:$2{{HOST}}$3__tco$3" r;
subs_filter "\"twitter.com\"" "\"{{HOST}}\"";
subs_filter "(https?:)?(\\\/\\\/|//)(cards?)\.twitter\.com(\\\/|/)" "https:$2{{HOST}}$4__twitter$4$3$4" r;
subs_filter "\"(/css/card_base\.css|/libs/require\.[0-9.]+min.js|/min/js/promotion_cards/main\.js)\"" "\"/__twitter/cards$1\"" r;
subs_filter "name=\"promotion-card-base-url\" value=\"\"" "name=\"promotion-card-base-url\" value=\"/__twitter/cards\"";
proxy_redirect https://mobile.twitter.com/ https://{{HOST}}/;
proxy_redirect https://twitter.com/ https://{{HOST}}/;
proxy_cookie_domain twitter.com {{HOST}};
location ~ /__bitly/(.*) {
proxy_pass http://bit.ly;
rewrite /__bitly/(.*) /$1 break;
}
location ~ /__tco/(.*) {
proxy_pass https://t.co;
rewrite /__tco/(.*) /$1 break;
proxy_redirect http://bit.ly http://t.cgh.io/__bitly;
}
location ~ /__twimg/([^/]+?)/(.*) {
resolver 8.8.8.8;
proxy_pass https://$1.twimg.com;
proxy_set_header Accept-Encoding "";
rewrite /__twimg/([^/]+?)/(.*) /$2 break;
}
location ~ /__mobile/(.*) {
proxy_pass https://mobile.twitter.com;
proxy_set_header Accept-Encoding "";
rewrite /__mobile/(.*) /$1 break;
}
location ~ /__twitter/([^/]+?)/(.*) {
resolver 8.8.8.8;
proxy_pass https://$1.twitter.com;
proxy_set_header Accept-Encoding "";
rewrite /__twitter/([^/]+?)/(.*) /$2 break;
}
location = /__mobile/ {
return 302 https://{{HOST}};
}
location = /api/destroy {
resolver 8.8.8.8;
proxy_pass $twitter;
proxy_set_header Accept-Encoding "";
proxy_hide_header content-security-policy;
proxy_hide_header content-security-policy-report-only;
add_header Set-Cookie "u=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT; domain={{HOST}}";
}
location / {
resolver 8.8.8.8;
proxy_pass $twitter;
proxy_set_header Accept-Encoding "";
proxy_hide_header content-security-policy;
proxy_hide_header content-security-policy-report-only;
}
}
map $http_user_agent $twitter {
default https://twitter.com;
"~*Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune" https://mobile.twitter.com;
}