简体   繁体   中英

CORS issue solution via proxy services or curl

I'm hitting a major road block while consuming services POST from this client who has no Access-Control-Allow-Origin at all.

I've tried following solutions or are you saying it's not possible at all?

  1. Looked into JSONP but that's limited to GET only.
  2. Created a service on my domain that can make a request to client domain. Ended up with { [Error: socket hang up] code: 'ECONNRESET' }
  3. Haven't tested, but can I've it accomplished using node-curl. https://www.npmjs.com/package/node-curl

Please advise.

So, why just not add this header? Just one line of code :)

You may run your own server which will forward requests to that service (nginx can easily do that, take a peek ).
In a nutshell:
frontend app -> your proxy with CORS headers (like nginx) -> api service

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM