Redirect API request from js to server-side if domain is blocked

142 Views Asked by At

I am planning to build a web-app that will send request to example.com endpoints

Accessing example.com may be blocked by the our system admin at the office, so sending request directly using client-side javascript will not work. Am I only left with the option of sending the API request from the clien-side js to my server(not blocked) and the server will be the one to forward the request to http://example.com?

If yes, this process will burn some time, how can I optimize this?

1

There are 1 best solutions below

0
On

There are more scenario's:

  • If all files are hosted at example.com, you can do nothing after blocking by (proxy) server
  • If clientside files aren't hosted there, you can use interceptors to catch blocked calls to example.com and retry to other server.

Related links: