Quarkus: Setting quarkus.http.cors.origins in application.yml

Created on 2 Oct 2020  路  5Comments  路  Source: quarkusio/quarkus

When setting properties

quarkus:
  http:
    cors: true
    "cors.origins": '*'

I would expect "quarkus.http.cors.origins" to be set to "*"

However

WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.http."cors.origins"" was provided; it will be ignored; verify that the dependency extension for this configuration is set or you did not make a typo

Steps to reproduce the behavior:

  1. set in application.yaml (use quarkus-config-yaml)
quarkus:
  http:
    cors: true
    "cors.origins": '*'
  1. watch for output in application logs

quarkus:1.8.1

you can however set quarkus.http.cors.origins in yml.

areconfig triaginvalid

Most helpful comment

You need to do:

quarkus:
  http:
    cors:
      ~: true

See https://quarkus.io/guides/config#configuration-key-conflicts for more details.

Closing now

All 5 comments

@rinmalavi should it be just origins ?

Well it works with quarkus.http.cors.origins in .yml as well as .properties
Not sure i undrestood "just origins"?
https://quarkus.io/guides/http-reference#cors-filter

@rinmalavi Oh I see what is the probllem, .cors is overloaded (used to enable and also acts as a segment key)

May be we should have quarkus.http.cors.enabled=true...

CC @gsmet @stuartwdouglas

You need to do:

quarkus:
  http:
    cors:
      ~: true

See https://quarkus.io/guides/config#configuration-key-conflicts for more details.

Closing now

@gastaldi super :-)

Was this page helpful?
0 / 5 - 0 ratings