Skip to content

Requests through a TLS-terminating proxy are seen as plain HTTP from the proxy's address #619

Backlog

Description

@MichaelLeeHobbs

Behind a reverse proxy that terminates TLS and forwards to the HTTP port (server.api.allowhttp = true), the engine can't tell the original request was HTTPS or who the client was. Only the HTTPS connector has a SecureRequestCustomizer, and nothing reads X-Forwarded-Proto, X-Forwarded-For or Forwarded. So for these requests:

Jetty's ForwardedRequestCustomizer reads these headers, but it trusts whoever connects. Turning it on as-is would let any direct client fake its scheme and address.

Proposal

Add server.api.trustedproxies: a comma-separated list of addresses, CIDR blocks or ranges, blank by default. When it's set, both connectors get a customizer that applies ForwardedRequestCustomizer only when the connection's peer address is in the list (Jetty's InetAddressSet). Blank keeps today's behavior.

Jetty uses the first X-Forwarded-For entry as the client address, so the proxy has to replace that header rather than append to it (nginx: proxy_set_header X-Forwarded-For $remote_addr;). The property comment would say so.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions