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

No Content-Type on / (info page) #1053

Closed
MarcelWaldvogel opened this issue Jan 5, 2022 · 2 comments · Fixed by #1054
Closed

No Content-Type on / (info page) #1053

MarcelWaldvogel opened this issue Jan 5, 2022 · 2 comments · Fixed by #1054
Labels
👶 good first issue Good for newcomers 🐞 bug Something isn't working 🍩 enhancement New feature or request ☕ java Related to Java code

Comments

@MarcelWaldvogel
Copy link
Contributor

The Kroki Docker container does not return a Content-Type header on requests to /. So, all the beautifully crafted information is not visible in browsers.

wget -S localhost:8000 also returns:

--2022-01-05 13:47:14--  http://localhost:8000/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8000... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  vary: origin
  content-length: 51198
Length: 51198 (50K)
Saving to: ‘index.html’

index.html               100%[======================================>]  50.00K  --.-KB/s    in 0s      

2022-01-05 13:47:14 (271 MB/s) - ‘index.html’ saved [51198/51198]

Setup: docker-compose.yml from the Docker installation guide

Versions tested against: latest (=0.16.0), 0.15.1, 0.14.0.

@ggrossetie
Copy link
Member

ggrossetie commented Jan 5, 2022

The Kroki Docker container does not return a Content-Type header on requests to /.

Indeed, we should add .putHeader(HttpHeaders.CONTENT_TYPE, "text/html"); here:

routingContext
.response()
.end(pageTemplate.replace("{versionsTable}", versionsTable));

We should also add a test to make sure that all the required headers are set. You can take inspiration from the other tests: https://github.com/yuzutech/kroki/tree/main/server/src/test/java/io/kroki/server/service

Feel free to open a pull request to fix it.

So, all the beautifully crafted information is not visible in browsers.

I don't think that's true, at least it renders just fine using Chrome and Firefox:

image

You can give it a try: https://a.kroki.io/

@ggrossetie ggrossetie added 👶 good first issue Good for newcomers ☕ java Related to Java code 🍩 enhancement New feature or request 🐞 bug Something isn't working labels Jan 5, 2022
@MarcelWaldvogel
Copy link
Contributor Author

I will look into this.

I don't think that's true, at least it renders just fine using Chrome and Firefox:

I only became aware of it, because it did not render fine in Firefox. But I have found the difference: My proxy adds some hardening headers by default, including X-Content-Type-Options: nosniff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👶 good first issue Good for newcomers 🐞 bug Something isn't working 🍩 enhancement New feature or request ☕ java Related to Java code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants