-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
CORS broken? #34669
Comments
@cescoffier ^^^ |
@edeandrea https://quarkus.io/guides/http-reference#cors-filter says that for the value be treated as a regular expression it has to be surrounded by forward slashes. |
@sberyozkin That doesn't work either. I tried that as well. I tried setting |
@edeandrea, Hmm, we have a test I believe for |
That cluster is gone unfortunately. That was from a week or so ago. |
@edeandrea I'd like to have a test confirming it works in principle, a regular expression supporting any origin, and that |
@sberyozkin why are we recommending a regexp equivalent to *? The regexp evaluation is more expensive than comparing with *. |
@cescoffier Hi, |
It's fixed at build time? Not according to the docs..... Also, I understand having |
We don't disallow it, we let users set it. Quarkus can't be taking responsibility for enabling a wildcard out of the box, we've already been affected once. |
Ok good. For some reason I must have mis-read your comment saying that wildcards would not be able to be done. |
I'm just preparing a test, sorry. This wildcard issue must be fixed, no doubt :-) |
Very strange, CORS filter has a dedicated support for |
@edeandrea Is it possible to set up Quarkus Superheroes without going through the whole workshop coding and configuration set up ? (I do look forward to catching up but would like to reproduce fast), FYI, I've downloaded ZIP from the workshop site but it fails to build, |
@sberyozkin the workshop and the sample that @edeandrea is talking about two different projects. It's the same theme, but the code is different, and the deployment logic is quite different. You want https://github.com/quarkusio/quarkus-super-heroes. |
@holly-cummins Can I try https://github.com/quarkusio/quarkus-super-heroes#running-locally-via-docker-compose ? I'm not sure deploying to OpenShift will make it any easier to trace what is going on, I may need to to trace HTTP traffic etc |
I was hoping to reproduce it locally, as long as services run on different ports, it should be reproducible |
The problem is not reproducable (I've found at least) if the apps are running on the same host or domain name. They have to have different domains (& therefore truly cross-origin). You could spin up each app in dev mode ( |
Hey @edeandrea @holly-cummins I've deployed to OpenShift,
All looks good, and I can access In any case, what do I need to press in UI to reproduce ? |
Someone called |
When everything is deployed in the same namespace things are ok. You'd have to deploy the UI and the fights service into separate clusters/namespaces for it to truly be cross origin. Just trying to load the UI was causing the error, which is kind of weird because it's a GET, which shouldn't need a pre-flight request. |
@edeandrea Unfortunately I can't create a new project in the OpenShift Dev Sandbox I got allocated. Can you recreate this multi-cluster setup if you've done it before ?
Such requests may still provide |
I can't right now (I'm at a conference) but I can try later or in a day or 2. |
Enjoy
It would be appreciated |
@edeandrea Hey, one more comment re:
Do you recall if it was failing with you configuring a wildcard or with only CORS enabled ? If this GET was same origin request, then CORS filter should handle it even without one having to enable a wildcard - but it works only if the CORS filter detects if the Origin header matches what RoutingContext says about the current request. So in OpenShift, it might not match if Origin is the the exposed route URL and RoutingContexts shows an internal URL. Having a wildcard enabled should work though |
It was a wildcard ( |
@edeandrea Can you link me please to where it is configured in Quarkus Heroes repo ? |
I wonder, if you supply it via the config map for example if it is somehow gets escaped or something like that |
No its set directly in the I’m on a plane today and the Wi-Fi is terrible. I’m back in the office tomorrow and will work on setting up a reproducer. |
Sorry @edeandrea I could've checked, just found it, yes, it looks fine. |
I did just check myself to make sure it wasn’t overridden anywhere in any of the |
Thanks @edeandrea FYI, checks if it is a wildcard only, see and then: |
I wonder if this is an area where our test coverage isn't what it could be, because it's really &*!&(! hard to set up a test rig where we have services on different domains talking to each other, with browsers thrown into the mix too. As @sberyozkin is discovering, even just trying to reproduce manually takes a lot of effort. |
Hi @sberyozkin I've spent some time today trying to re-create this issue using 2 separate OpenShift clusters, deploying the UI on one cluster and the rest of the services on another cluster. I can't seem to reproduce it. Things seem to work fine. Maybe there was some network hiccup or something weird when I tried to do this originally? I'm not sure. @holly-cummins I was also able to get JKube remote dev to work as well, even in this multi-cluster setup, so I think we can close this issue? If I come across it again I'll go ahead and re-open it. Thank you @sberyozkin for diving into it so quickly! |
Hey @edeandrea Glad to hear it, np at all, good things are working now. |
There's an open issue for it thats been around for some time... |
@edeandrea and All Many thanks, this. quarkus.http.cors.origins=/.*/ worked for me |
Describe the bug
I'm not sure how far this goes back, but I started noticing it in Quarkus 3.1.x and it still exists in 3.2.x. There seems to be something broken with CORS.
Expected behavior
I would expect since
rest-fights
hasin it's
application.properties
that all requests would pass CORS, but that doesn't seem to be the case.Actual behavior
In the Quarkus superheroes app if I deploy all the apps in the same namespace everything is fine, but if I move the UI app out to another namespace or to a different cluster, the Angular app can no longer communicate with the
rest-fights
app.@holly-cummins and I originally thought it was something we/she did when we moved the UI image from Node.js to Quarkus Quinoa, but I've heard reports of others seeing similar issues.
The UI gets a
500
error back fromrest-fights
with this:(That cluster with those URLs are long gone - I just saved the error from the last time I saw it)
the
rest-fights
app has this config in it'sapplication.properties
:How to Reproduce?
Deploy the Quarkus Superheroes somewhere where the UI app is on a different host than the
rest-fights
app and configure the UI URL accordingly.Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
3.1.x, but not sure if this existed in previous versions.
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: