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

Can not set HTTP Header from ENV variable #25833

Closed
EnriqueHernandezL opened this issue May 27, 2022 · 4 comments · Fixed by #26123
Closed

Can not set HTTP Header from ENV variable #25833

EnriqueHernandezL opened this issue May 27, 2022 · 4 comments · Fixed by #26123
Assignees
Labels
area/config kind/bug Something isn't working
Milestone

Comments

@EnriqueHernandezL
Copy link

Describe the bug

I tried to pass quarkus.http.header."Cache-Control".value=no-cache as a environmental variable to my Quarkus Server by setting QUARKUS_HTTP_HEADER__CACHE_CONTROL__VALUE as the variable name.

Expected behavior

Expected server response

...
Cache-Control: no-cache
...

Actual behavior

Actual server response

...
Cache.control: no-cache
...

How to Reproduce?

Make a quarkus HTTP Server and try to set the described header as an environmental variable. Then curl the server.

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

No response

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

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)

Additional information

No response

@EnriqueHernandezL EnriqueHernandezL added the kind/bug Something isn't working label May 27, 2022
@mschorsch
Copy link
Contributor

CC @radcortez

@geoand
Copy link
Contributor

geoand commented May 30, 2022

Does QUARKUS_HTTP_HEADER_CACHE_CONTROL_VALUE work?

@mschorsch
Copy link
Contributor

Does QUARKUS_HTTP_HEADER_CACHE_CONTROL_VALUE work?

It doesn't work.

QUARKUS_HTTP_HEADER__CACHE_CONTROL__VALUE is correct. I think that the environment variable name does not contain enough information to convert _ in . or -.

@radcortez radcortez self-assigned this Jun 14, 2022
@radcortez
Copy link
Member

In this case, when you only have an environment variable like quarkus.http.header."Cache-Control".value=no-cache and the Cache-Control portion is a key, we don't know if CACHE_CONTROL needs to be converted to cache.control or cache-control. The default is always to use the ..

To convert this property properly, we need additional information. Just add the property name in one of the lower ordinal sources in the format quarkus.http.header."Cache-Control".value=no-cache. This will let us know the correct way to map the environment variable name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants