You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources.
(emphasis added)
The incoming request determines the server's origin, including the scheme.
The Helidon CORS processing does not consider whether the request is secure or not (that is, whether its scheme is http or https) in deciding whether the origin conveyed in the request's headers is the same as the server's origin.
Steps to reproduce
Use the examples/cors example.
Edit src/main/resources/logging.properties to contain these lines (uncommented):
The response is 404, because CORS incorrectly concluded the origin (https in the Origin header) and host (http as derived from the request in the code) shared the same location because it does not consider the scheme of the server's origin.
The logging output from the server contains this, also reflecting the error:
is not cross-host: [header ORIGIN 'https://here.com' matches header HOST 'here.com']
which is true as far as it goes, but the CORS decision-making should also consider the host and origin schemes which it does not.
The text was updated successfully, but these errors were encountered:
tjquinno
changed the title
CORS incorrectly disregards whether the incoming request is secure or not in deciding whether it's a CORS request
[4.x] CORS incorrectly disregards whether the incoming request is secure or not in deciding whether it's a CORS request
Dec 1, 2023
Environment Details
Problem Description
As explained here https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS (near the top):
(emphasis added)
The incoming request determines the server's origin, including the scheme.
The Helidon CORS processing does not consider whether the request is secure or not (that is, whether its scheme is
http
orhttps
) in deciding whether the origin conveyed in the request's headers is the same as the server's origin.Steps to reproduce
Use the
examples/cors
example.src/main/resources/logging.properties
to contain these lines (uncommented):mvn clean package
java -jar target/helidon-examples-cors.jar
The response is 404, because CORS incorrectly concluded the origin (
https
in theOrigin
header) and host (http
as derived from the request in the code) shared the same location because it does not consider the scheme of the server's origin.The logging output from the server contains this, also reflecting the error:
which is true as far as it goes, but the CORS decision-making should also consider the host and origin schemes which it does not.
The text was updated successfully, but these errors were encountered: