question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTTP CORS headers not included.

See original GitHub issue

Describe the bug

We have the following settings in our application properties

quarkus.http.cors=${QUARKUS_HTTP_CORS_ENABLED:true}
quarkus.http.cors.methods=${QUARKUS_HTTP_CORS_METHODS:GET,POST}
quarkus.http.cors.access-control-max-age=${QUARKUS_HTTP_CORS_ACCESS_CONTROL_MAX_AGE:24H}

Expected behavior

CORS headers included

Actual behavior

CORS headers not included.

However, changing the configuration (strangly enough) to

quarkus.http.cors=false

Or omitting this setting altogether will trigger the headers.

which seems to be in conflict to the documentation

How to Reproduce?

Service with quarkus.http.cors=false: https://publiek.broservices.nl/gm/gmw-v1.1/openapi

Service with

quarkus.http.cors=${QUARKUS_HTTP_CORS_ENABLED:true}
quarkus.http.cors.methods=${QUARKUS_HTTP_CORS_METHODS:GET,POST}
quarkus.http.cors.access-control-max-age=${QUARKUS_HTTP_CORS_ACCESS_CONTROL_MAX_AGE:24H}

https://publiek.broservices.nl/gm/gmn-v1.0/openapi

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.3.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

mvn 3.6.3

Additional information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:25 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
sjaakdcommented, Nov 16, 2021

Hi @sjaakd @sberyozkin - Happy to have a look. Please provide a small reproducer that I can run locally. Thanks 😃

Hi @phillip-kruger thanks… I’ll do my best to provide one as soon as possible (hopefully a bit later this week).

1reaction
sjaakdcommented, Nov 15, 2021

@sjaakd Thanks, what happens if you do:

quarkus.http.cors=true
quarkus.http.cors.methods=GET,POST
quarkus.http.cors.access-control-max-age:24H

? Would like to see if the system property replacement is a problem or not

Just tried that locally.

image

No effect.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cross-Origin Resource Sharing (CORS) - MDN Web Docs
Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, ...
Read more >
CORS and the Access-Control-Allow-Origin response header
The Access-Control-Allow-Origin header is included in the response from one website to a request originating from another website, and identifies the permitted ...
Read more >
CORS header 'Access-Control-Allow-Origin' missing
I'm calling this function from my asp.net form and getting following error on firebug console while calling ajax. Cross-Origin Request Blocked: The Same...
Read more >
Fixing "No 'Access-Control-Allow-Origin' Header Present"
Sure, it tells you that there's a header missing, but from where is it missing, ... header is a Cross-Origin Resource Sharing (CORS)...
Read more >
Resolve the "No 'Access-Control-Allow-Origin' header" error ...
HTTP /1.1 200 OK Server: nginx/1.10.2 Date: Mon, 01 May 2018 03:06:41 GMT ... If CORS headers are not returned in the response,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found