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

Problems with POST on Firebase #445

Open PeWu opened 1 year ago

PeWu commented 1 year ago

I don't know if this is a cors-anywhere, cors-server or Firebase issue.

I'm trying to set up a proxy on Firebase using https://github.com/isoaxe/cors-server and I'm having trouble proxying POST requests. The main goal is to make my project (https://pewu.github.io/topola-viewer/) work again with a new proxy after Heroku free tier has been turned down.

Here is what I was able to destil using cors-server running on Firebase.

This works:

curl -H "Content-Type: application/json" -X POST https://postman-echo.com/post -d test

This works:

curl https://proxy-m4bvvb54la-uc.a.run.app/https://postman-echo.com/post  -H "Origin: http://localhost:3000" -X POST

This doesn't work:

curl https://proxy-m4bvvb54la-uc.a.run.app/https://postman-echo.com/post  -H "Origin: http://localhost:3000" -X POST -d test

Stops working after adding -d test

Log in Firebase:

The request has been terminated because it has reached the maximum request timeout. To change this limit, see https://cloud.google.com/run/docs/configuring/request-timeout

Just from this log it's not possible to deduce whether the timeout was caused by cors-anywhere, cors-server or Firebase. I don't expect postman-echo.com to time out. Anyway, the problem appears not only with postman-echo.com.

camilohr18 commented 11 months ago

hi @PeWu, did you find any solution?? I have same problem.

PeWu commented 11 months ago

Not really. My solution was to not use Firebase.

camilohr18 commented 11 months ago

and by any chance may I know wich one did you use?? and how did you configure it?? Will help me a lot!!

PeWu commented 11 months ago

I'm hosting my cors-anywhere proxy on https://mikr.us/ – this is a Polish hosting service. It costs 35 PLN (around $8.50) per year for a minimal setup. My instance is running at https://topolaproxy.bieda.it/

I only changed the originWhitelist from the original repo. My repo is here: https://github.com/PeWu/cors-server

camilohr18 commented 11 months ago

Thanks for your answer. I think it possible to make the deploy but we are missing something with firebase. I already deploy on render.com and I will check some options on firebase, should work if we modify something on Gcloud, but to my project I will use a pay service for now. If I found something I will let you know.