Rob--W / cors-anywhere

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

400 Bad Request #452

Closed ricoxor closed 1 year ago

ricoxor commented 1 year ago

Hello, I have two requests to bypass, one GET and one POST, It's to use the Twitter API. One request to fetch tweets and one to post a tweet. I don't have any issue with the GET request thought cors-anywhere but I have a 400 Bad Request with the post request. I added "Authorization" to required headers on cors-anywhere.

Here is the POST request who return 400 Bad Request :

Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: fr-FR,fr
Authorization: OAuth oauth_consumer_key=".......
Connection: keep-alive
Content-Length: 100
Content-Type: text/plain;charset=UTF-8
Host: cors-everywhere-app.herokuapp.com
Origin: http://localhost:3000
Referer: http://localhost:3000/
sec-ch-ua: "Brave";v="111", "Not(A:Brand";v="8", "Chromium";v="111"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-site
Sec-GPC: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36

body :

{
    "text": comment,
    "reply": { "in_reply_to_tweet_id": tweetId }
}

Here is the working GET request :

Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: fr-FR,fr
Authorization: Bearer ...............
Connection: keep-alive
Host: cors-everywhere-app.herokuapp.com
Origin: http://localhost:3000
Referer: http://localhost:3000/
sec-ch-ua: "Brave";v="111", "Not(A:Brand";v="8", "Chromium";v="111"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: cross-site
Sec-GPC: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36

I don't know why the POST request don't work, when I do the request with Postman it works.

Rob--W commented 1 year ago

It is unlikely for the issue to have been caused by the proxy. You should compare the successful postman request with what you're doing here.

If the request details (URL, headers, body) are identical, then it may be a server-side issue.