0

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.

Óscar
  • 650
  • 1
  • 4
  • 16

1 Answers1

2

The scheme of 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 :scheme pseudo-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 is http (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 Forwarded RFC7239 headers.

There is no provision in CustomRequestLog to write the authority or scheme currently.

So I opened an enhancement request for it https://github.com/eclipse/jetty.project/issues/9980

Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136