简体   繁体   中英

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

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

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