Skip to main content
Solved

How can I make a POST request send the Access-Control-Allow-Origin response header (job submit)

  • February 26, 2020
  • 2 replies
  • 45 views

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

Best answer by pascalatsafe

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.

View original
Did this help you find an answer to your question?

2 replies

pascalatsafe
Safer
Forum|alt.badge.img+1
  • Safer
  • Best Answer
  • February 27, 2020

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.


  • Author
  • March 2, 2020

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings