Rob--W / cors-anywhere

CORS Anywhere is a NodeJS reverse proxy which adds CORS headers to the proxied request.
MIT License
8.57k stars 5.99k forks source link

How to setup with websocket? #411

Closed Aslam97 closed 2 years ago

Aslam97 commented 2 years ago

I tried to access data from x.com but does not work.

What I've tried ws://cors-anywhere:8080/wss://stream.x.com:4932

The error say Connection failed.

Aslam97 commented 2 years ago

I end up using only nginx to pass proxy

location /stream/ {
        proxy_pass https://stream.x.com:port/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $host;
     }
location /api/ {
        add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization';
        proxy_pass https://api.x.com/api/;
}