How can I include the URL request scheme (HTTP or HTTPS) in Jetty 10 request log? Something similar with what can be done in Apache but for Jetty.
I am using this setting:
jetty.requestlog.formatString='%{client}a - %u %t "%r" %s %O "%{Referer}i" "%{User-Agent}i" %{server}a'
which is basically a standard log plus the requested domain at the end. I would like to add http:// or https:// to the requested domain.
The
schemeof a request is not present on an HTTP/1.0 or HTTP/1.1 request.In HTTP/2 and HTTP/3 that scheme is present as the
:schemepseudo-header on all requests.The scheme in Jetty could be any of the supported schemes that the Connectors support (eg: "fcgi", "http", "https", "ws", "wss", etc).
In practice the scheme comes from the request authority.
In HTTP/1.0 and HTTP/1.1 the scheme is determined by a combination of Connector security settings and Forwarding headers, if the request is secure, then the scheme is
https, otherwise it ishttp(unless overridden by Forwarding headers to be something else).On HTTP/2 and HTTP/3 the scheme is built into the low level protocol, but can be overridden by the
ForwardedRFC7239 headers.There is no provision in
CustomRequestLogto write the authority or scheme currently.So I opened an enhancement request for it https://github.com/eclipse/jetty.project/issues/9980