WebHttpRequest1

Hello,

I am attempting to send http request to a local server with paramteres:

WebHttpRequest1.Headers.AddPair('Access-Control-Allow-Origin', '*');
WebHttpRequest1.URL := 'http://localhost/flix/EANService/GetEans?EanCode=5055956189878';

WebHttpRequest1.Execute;

Upon execute I get an error on the webpage:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost/flix/EANService/GetEans?EanCode=5055956189878. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost/flix/EANService/GetEans?EanCode=5055956189878. (Reason: CORS request did not succeed).

uncaught exception: [object Object]

I can confim this URL request work OK with Postman
what am i missing?

Thank you for your assistance

CORS policy needs to be set server side.

For full details about CORS, please see:
https://developer.mozilla.org/nl/docs/Web/HTTP/CORS
Hello Bruno,

Many thanks - i found the issue - I forgot to add XdataSeverCors to the Middleware list.

Resolved.