Use a list of CIDR for trusted-proxies

Abierto
#4,371 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@vasipallyn ya está trabajando en esto.

Desde el 13/11/2026.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java, spring-boot

Línea de trabajo

Start by finding where spring.cloud.gateway.server.webmvc.trusted-proxies is bound and where its regular expression is matched against the remote address, using a search for the property name. The issue asks for a list of IP addresses and CIDR ranges, including IPv6 such as ::1/128, in place of the regex. Done means the YAML example in the issue is accepted and matched correctly, with tests covering IPv4, IPv6 and non-matching addresses. Whether the regex form stays supported is a design question to confirm with maintainers.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

waiting-for-triage

Is your feature request related to a problem? Please describe.

The spring.cloud.gateway.server.webmvc.trusted-proxies property currently uses a regular expression to identify trusted proxies.

However, getRemoteAddr() already returns the IP address of the client or the last proxy that sent the request:

/**
 * Returns the Internet Protocol (IP) address of the client or last proxy that sent the request. For HTTP servlets,
 * same as the value of the CGI variable <code>REMOTE_ADDR</code>.
 *
 * @return a <code>String</code> containing the IP address of the client that sent the request
 */

Since this property is intended to identify trusted proxies based on their IP addresses, using regular expressions seems unnecessarily complex and makes the configuration harder to maintain.

Describe the solution you'd like

Replace the regular expression with a list of IP addresses and CIDR ranges.

For example:

spring:
  cloud:
    gateway:
      server:
        webmvc:
          trusted-proxies:
            - 10.0.0.0/8
            - 172.16.0.0/12
            - 192.168.0.0/16
            - 127.0.0.1/32
            - ::1/128
Lenguaje dominante
Java
Estrellas
4.9k
Forks
3.5k
Merge medio
1 d 13 h
PR fusionados (30 d)
14

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de spring-cloud/spring-cloud-gateway

Todos los issues de spring-cloud/spring-cloud-gateway

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.