Rajeshkumar
Rajeshkumar

Reputation: 895

How to overcome cross origin request from CPanel?

I have a single javascript function it will consume some public API and display the response. But the server doesn't allow cross origin requests. So I made the request to my own localhost where I will redirect via ProxyPass and ProxyPass reverse to the actual server. Everything is ok.

But when I move this code to my online domain, I changed the API url to actual one. But I am getting the same error as cross origin. I don't have access to httpd.conf file of my domain. It is a simple domain. So how can I achieve this from my domain?

Any suggestions?

Upvotes: 0

Views: 1308

Answers (1)

Maxim Gritsenko
Maxim Gritsenko

Reputation: 2592

If the public API does not allow cross-origin requests, probably it is not supposed to be called from other domains...

But if you are sure it is, your only option is to use proxy, that will be either on your domain, or will set the correct cross-origin header. You cannot achieve it only with client-side JavaScript.

Upvotes: 1

Related Questions