Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

CORS Request(POST) - Custom Header doesn't work

Hi,
I made a REST API (POST) for create a new ressource in the Database, and it works when I test it with Firefox RestClient.
But when I try to call the API from a web application, I got a CORS error. I tried to set custom headers in the tRestresponse's advanced setting, and got the pre-flight response (OPTIONS) which is 200 OK, but looking at its header, I didn't found what I set in the component tRestresponse. It seems that what I set is not valide.
So the question is: how to enable CORS for API (POST)?
Thanks in advances!
Labels (3)
3 Replies
Anonymous
Not applicable
Author

Hi,
Are you using tRESTRequest? Could you please take a look at a jira issue: https://jira.talendforge.org/browse/TESB-10065 to see if it is what you are looking for?
Best regards
Sabrina
Anonymous
Not applicable
Author

I have the same issue and I am not using tRESTRequest. The client application makes a preflight request and the response is missing my custom headers. I am using Talend ESB Open Source 6.1.1. Is there a solution for this?
Anonymous
Not applicable
Author

I ended up figuring out how to fix the issue. In tRESTRequest you have to create a separate entry with the same URL that uses the HTTP Verb OPTIONS. Then configure your headers to set the required CORS headers.
This is only required if your client application creates preflight requests.