Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origin with path in the uri rejected #51

Open
Sorikairox opened this issue Nov 4, 2019 · 1 comment
Open

Origin with path in the uri rejected #51

Sorikairox opened this issue Nov 4, 2019 · 1 comment
Assignees
Labels

Comments

@Sorikairox
Copy link

Sorikairox commented Nov 4, 2019

So, long story short :

OPTIONS with the following origin works : http://127.0.0.1:8080 returning :

* Connection state changed (MAX_CONCURRENT_STREAMS updated)! < HTTP/2 200 < date: Tue, 05 Nov 2019 08:49:29 GMT < content-length: 0 < server: nginx/1.17.5 < access-control-allow-headers: content-type < access-control-allow-origin: * < access-control-allow-methods: POST, PUT, GET, OPTIONS, DELETE < access-control-max-age: 600

OPTIONS with the following origin doesn't : http://127.0.0.1:8080/mycoolpage

* Connection state changed (MAX_CONCURRENT_STREAMS updated)! < HTTP/2 204 < date: Tue, 05 Nov 2019 08:48:54 GMT < server: nginx/1.17.5 < allow: POST <

My Akka Http Cors is the following :

private val corsSettings: CorsSettings = CorsSettings(actorSystem)
     .withAllowedOrigins(HttpOriginMatcher.*)
     .withAllowCredentials(false)
     .withAllowedMethods(scala.collection.immutable.Seq(HttpMethods.POST, HttpMethods.PUT, HttpMethods.GET, HttpMethods.OPTIONS, HttpMethods.DELETE))
     .withExposedHeaders(scala.collection.immutable.Seq(
       "Content-Type",
       "X-Content-Type",
       "x-access-token",
       "x-refresh-token",
     ))

Akka doesn't seem to manage origin which are not hostnames ?

@lomigmegard
Copy link
Owner

lomigmegard commented Nov 5, 2019

Hi,

Could you also send the corresponding full requests (including headers) ?

Note that your Origin request header (see https://www.w3.org/TR/cors/#origin-request-header) must follow rfc6454 syntax, which does not include a path. It could be the case that akka-http just fails at parsing your request (you could look at the source to be sure).

@lomigmegard lomigmegard self-assigned this Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants