The response has the "access-control-allow-origin", "access-control-max-age" and "access-control-allow-methods" headers
$ curl -v --request OPTIONS 'localhost:8081/test' --header 'Origin: https://example.com' --header 'Access-Control-Request-Method: GET' * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8081 (#0) > OPTIONS /test HTTP/1.1 > Host: localhost:8081 > User-Agent: curl/7.64.1 > Accept: */* > Origin: https://example.com > Access-Control-Request-Method: GET > < HTTP/1.1 200 OK < access-control-allow-methods: CONNECT, DELETE, GET, OPTIONS, PATCH, POST, PUT, TRACE < access-control-max-age: 30 < access-control-allow-origin: https://example.com < Transfer-Encoding: chunked < Date: Thu, 24 Sep 2020 23:37:39 GMT < * Connection #0 to host localhost left intact * Closing connection 0
curl -v --request GET 'localhost:8081/test' --header 'Origin: https://example.com'
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8081 (#0)
> GET /test HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.64.1
> Accept: */*
> Origin: https://example.com
>
< HTTP/1.1 200 OK
< access-control-allow-origin: https://example.com
< Content-Type: application/json; charset=UTF-8
< Content-Length: 21
< Date: Thu, 24 Sep 2020 23:40:29 GMT
<
{
"payload": "Ok"
* Connection #0 to host localhost left intact
}* Closing connection 0
curl -v --request GET 'localhost:8081/test' --header 'Origin: https://wrong.example.com' Note: Unnecessary use of -X or --request, GET is already inferred. * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8081 (#0) > GET /test HTTP/1.1 > Host: localhost:8081 > User-Agent: curl/7.64.1 > Accept: */* > Origin: https://wrong.example.com > < HTTP/1.1 200 OK < Transfer-Encoding: chunked < Date: Thu, 24 Sep 2020 23:41:07 GMT < * Connection #0 to host localhost left intact * Closing connection 0The same happens in a preflight CORS request
curl -v --request OPTIONS 'localhost:8081/test' --header 'Origin: https://wrong.example.com' --header 'Access-Control-Request-Method: GET' * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8081 (#0) > OPTIONS /test HTTP/1.1 > Host: localhost:8081 > User-Agent: curl/7.64.1 > Accept: */* > Origin: https://example1.com > Access-Control-Request-Method: GET > < HTTP/1.1 200 OK < Transfer-Encoding: chunked < Date: Thu, 24 Sep 2020 23:44:15 GMT < * Connection #0 to host localhost left intact * Closing connection 0If miss the "Access-Control-Request-Method" header in a preflight request, it has the same response as with a wrong "Origin" header
curl -v --request OPTIONS 'localhost:8081/test' --header 'Origin: https://example1.com' * Trying 127.0.0.1... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 8081 (#0) > OPTIONS /test HTTP/1.1 > Host: localhost:8081 > User-Agent: curl/7.64.1 > Accept: */* > Origin: https://example1.com > < HTTP/1.1 200 OK < Transfer-Encoding: chunked < Date: Thu, 24 Sep 2020 23:51:58 GMT < * Connection #0 to host localhost left intact * Closing connection 0
001115964

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.