Skip to content

Instantly share code, notes, and snippets.

@jameswhite
Forked from mariotaku/README.txt
Created July 1, 2023 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameswhite/13c45cc9a918fa3f233a11fb758869ff to your computer and use it in GitHub Desktop.
Save jameswhite/13c45cc9a918fa3f233a11fb758869ff to your computer and use it in GitHub Desktop.
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