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

Jetty12 doesn't set the Date response header when using localhost #11292

Closed
chiqiu opened this issue Jan 19, 2024 · 5 comments · Fixed by #11293
Closed

Jetty12 doesn't set the Date response header when using localhost #11292

chiqiu opened this issue Jan 19, 2024 · 5 comments · Fixed by #11293

Comments

@chiqiu
Copy link

chiqiu commented Jan 19, 2024

Jetty Version
12.03
Jetty Environment

ee10
Java Version
17.0.9
Question

Jetty doesn't set the Date response header when using localhost.
If using the domain name to access it the response Date header will be set.
Is it an expected behavior or some additional configuration needs to be configured?
Thanks!

@joakime
Copy link
Contributor

joakime commented Jan 19, 2024

Check your HttpConfiguration.

See if your .setSendDateHeader(true) is set. (it defaults to true, so if you don't set it, it should remain true).

But this doesn't explain the difference in behavior you are seeing between calling a handler with Host: localhost vs Host: example.org vs Host: 192.168.1.1

joakime added a commit that referenced this issue Jan 19, 2024
* Revert changes to boolean values in HttpConfiguration from commit 103e1d9
* Add Unit Tests for Date Response header
  in ee10 and DistributionTests
@joakime
Copy link
Contributor

joakime commented Jan 19, 2024

Was able to replicate the fact that the Date header is not present when using Standlone / jetty-home.
But I was unable to replicate the differences when making the same request to the same server but using different Host names.
Opened PR #11293 for what I was able to find.

@joakime joakime self-assigned this Jan 19, 2024
@janbartel
Copy link
Contributor

@chiqiu can you provide a reproduction test case that makes clear how the hostname difference affects the Date header, as it is not obvious. As @joakime says, when using embedded mode, by default jetty will send the Date header, but when using the distro the default is not to send the Date header. Not an ideal situation, but it's been that way since at least jetty-9.4. But either way, I don't see the involvement of the hostname, so a repro test case will be necessary.

@janbartel
Copy link
Contributor

@chiqiu nudge?

@chiqiu
Copy link
Author

chiqiu commented Jan 24, 2024

@chiqiu nudge?
Sorry,
I will try to upload a test , I was too busy these two days
Thanks

joakime added a commit that referenced this issue Jan 25, 2024
* Add Unit Tests for Date Response header
  in ee10 and Distribution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants