Bruno Gomes
Bruno Gomes

Reputation: 1425

Freshdesk API CORS issue

I'm trying to access the api of my helpdesk. I want to create a ticket automatically, like "hit the button" and create a default ticket.

So, I am programming a POST method to my tickets.json, but I always get an ERROR:

SEC7118: XMLHttpRequest para http://XXXX.freshdesk.com/helpdesk/tickets.json exigia CORS (Compartilhamento de Recursos entre Origens).

SEC7119: XMLHttpRequest para http://XXXX.freshdesk.com/helpdesk/tickets.json exigia simulação de CORS.

So, as you can see, it's a CORS error

I'm following the authorization requirement by using it in the header of my request

Authorization: Basic encode64('login':'pw')

But, I still have this issue.

PS: There is a ticket in freshdesk too. https://support.freshdesk.com/support/tickets/112829

Upvotes: 1

Views: 1850

Answers (1)

aet
aet

Reputation: 7292

Not exactly the answer, but an alternative approach is to use your webserver as a reverse proxy to the backend. With nginx this can be achieved like this: (this goes in the "server" block)

location /api {
  proxy_pass https://api.backend.com/v1;
  proxy_redirect off;
}

Here is a link that describes it in some more detail: http://www.cyberciti.biz/tips/using-nginx-as-reverse-proxy.html

For apache: https://www.digitalocean.com/community/articles/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension

Upvotes: 1

Related Questions