Skip to main content

Hello community,

I'm trying to call the REST API in ajax from another application. In this call, I do a POST request to submit a workspace. The call works fine in Postman and I get a job id in return.

However in the response headers, I only get the following parameters: Content-Length, Content-Type and Date. For the purpose of my application, I also need the Access-Control-Allow-Origin in the response headers.

Any idea how I can make that happen?

version used: FME server 19.1 over https (port 8443)

Thanks in advance

FME Server will only return the Access-Control-Allow-Origin header and other Access-Control-* (CORS) header if an Origin header was present in the request. When performing Ajax requests using Javascript, the browser will include that header by default, but Postman does not. It is possible to set a value in Postman if you are testing CORS.

 

 

For the nitty-gritty details on why Access-Control-Allow-Origin is not provided when there is no Origin header in the request, you can refer to this: https://www.w3.org/TR/access-control/#resource-requests.

And for more information on how to configure CORS for FME Server: https://docs.safe.com/fme/html/FME_Server_Documentation/WebUI/CORS.htm.


Thnaks very much for this answer.

It did work when I add the Origin for Postman. Will try that in my web application too.

And thanks for the additional documentations too.

Kind regards

Elodie


Reply