Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty10 and request.getHeader("Host")

You can use HttpServletRequest.getServerName() and HttpServletRequest.getServerPort() to have a consistent API for both HTTP/1.1 and HTTP/2

Joakim Erdfelt / joakim@xxxxxxxxxxx


On Mon, Sep 21, 2020 at 12:00 PM Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
Ah, HTTP/2.

Well, HTTP/2 doesn't have a "Host" header, it has an ":authority" header.

chrome-http2-authority-header2.png

Joakim Erdfelt / joakim@xxxxxxxxxxx


On Mon, Sep 21, 2020 at 11:27 AM Silvio Bierman <sbierman@xxxxxxxxxxxxxxxxxx> wrote:
Hello Joakim,

I am using HTTP/2. It is a plain HTTPS GET from the browser (Chromium) using a domain name that is mapped to local (127.0.0.1) and that matches one of the certificates in my key store.

I dumped request.getHeaderNames and there is no Host header in there. But the same thing works with Jetty9 although I did not dump the headers with that one.

Kind regards,

Silvio

On 9/21/20 6:18 PM, Joakim Erdfelt wrote:
What version of HTTP? (HTTP/1.0, HTTP/1.1, or HTTP/2)

Also, what does the entire request look like? (eg: if HTTP/1.1, what's the request line plus headers?)

Joakim Erdfelt / joakim@xxxxxxxxxxx


On Mon, Sep 21, 2020 at 10:45 AM Silvio Bierman <sbierman@xxxxxxxxxxxxxxxxxx> wrote:
Hello all,

I am testing our application that runs on embedded Jetty9 with (also
embedded) Jetty 10 beta. It fails very early because our application
calls request.getHeader("Host") which appears to return null. I used the
same embedding code which works flawlessly with Jetty9. Is there
something I am doing wrong?

Cheers,

Silvio
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top