Use a list of CIDR for trusted-proxies

オープン
#4,371 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@vasipallyn がすでに取り組んでいます。

2026年11月13日 から。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java, spring-boot

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
Java
スター
4.9k
フォーク
3.5k
平均マージ
1日 13時間
マージ済み PR(30日)
14

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

spring-cloud/spring-cloud-gateway のほかの issue

spring-cloud/spring-cloud-gateway の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。