Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Twitter reverse proxy configuration for Nginx
Settings on Twidere:
API URL Format: https://your-host/[DOMAIN.]twitter.com/
Uncheck "Same OAuth signing URL"
Uncheck "No verion suffix"
Password login recommended.
upstream twitter_userstream {
server userstream.twitter.com:443;
keepalive 300;
}
server {
listen 443 ssl spdy;
server_name [YOUR-SERVER-NAME-HERE];
ssl_certificate [/path/to/ssl/certificate/cert.pem];
ssl_certificate_key [/path/to/ssl/certificate/privkey.pem];
location ~ ^/userstream\.twitter\.com/(.*) {
resolver 8.8.8.8;
proxy_pass https://twitter_userstream/$1$is_args$args;
proxy_cookie_domain twitter.com $server_name;
proxy_buffering off; # Turn off buffer in order to get stream as-is
proxy_set_header Host userstream.twitter.com;
proxy_http_version 1.1; # This was necessary!!!
}
location ~ ^/([\w\d-_]+)\.twitter\.com/(.*) {
resolver 8.8.8.8;
proxy_pass https://$1.twitter.com/$2$is_args$args;
proxy_cookie_domain twitter.com $server_name;
}
location / {
root [/path/to/welcome/file];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment