Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Create new API Proxy with Node and CORS

Not applicable

I want to create a API proxy that is Node based but I also want to add CORS at the same time. The console doesn’t allow CORS to be added at time of creation. Also when I try to add CORS policy to an existing proxy it’s doesn’t show up in the policy drop-down menu. Any suggestions on the best way to handle either of the 2 issues above?

Solved Solved
0 6 1,168
1 ACCEPTED SOLUTION

Not applicable

I tried your suggestion and that didn't work either, I think the reason is it couldn't find CORS.

So, I downloaded the proxy from the console, then I manually added "node_modules/cors" to the resource folder and I added CORS and CORSPreflight to the policies folder. Zipped it and uploaded a new version of the proxy using the console.

This may be overkill, but it's now working on both my mobile app and Javascript/HTML.

Thanks for your help.

View solution in original post

6 REPLIES 6