[GH-ISSUE #2254] proxy_protocol + nginx = broken header? #1792

Closed
opened 2026-05-05 13:09:32 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @RockyLOMO on GitHub (Feb 22, 2021).
Original GitHub issue: https://github.com/fatedier/frp/issues/2254

[REQUIRED] hat version of frp are you using

Version: 0.35.1

[REQUIRED] What operating system and processor architecture are you using
OS: windows 10
CPU architecture: amd64

[REQUIRED] description of errors
client -> frps -> [frpc -> nginx(windows v1.18.0)] -> web server

proxy_protocol_version = v2
nginx error

*182 broken header: "  ü³򎫥ZW뇝ş½h՘!¾I«r1³D¿) +šXu÷+U¹>§!°Bzg°)$ú ~¾‹|‡Ž›• "

À+À/À,À0̨̩ÀÀ œ  /" while reading PROXY protocol, client: 127.0.0.1, server: 0.0.0.0:443

confile

frpc

[web-1]
type = http
local_ip = 127.0.0.1
local_port = 80
custom_domains = xx.cn
[web-2]
type = https
local_ip = 127.0.0.1
local_port = 443
custom_domains = xx.cn
proxy_protocol_version = v2

nginx

server {
    listen 443 ssl http2 proxy_protocol;
    set_real_ip_from 127.0.0.1;
    real_ip_header proxy_protocol;
    real_ip_recursive on;
    server_name xx.cn;
	
    ssl_certificate .xx.pem;
    ssl_certificate_key xx.key;
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_prefer_server_ciphers on;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_verify_client off;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Forwarded-Host $the_host;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;

    add_header Strict-Transport-Security max-age=31536000;
    add_header X-Content-Type-Options nosniff;

    location / {
        proxy_pass http://xx;
    }
}

log file

Steps to reproduce the issue
1.
2.
3.

Supplementary information

Can you guess what caused this issue

Checklist:

  • [] I included all information required in the sections above
  • [] I made sure there are no duplicates of this report (Use Search)
Originally created by @RockyLOMO on GitHub (Feb 22, 2021). Original GitHub issue: https://github.com/fatedier/frp/issues/2254 <!-- From Chinese to English by machine translation, welcome to revise and polish. --> <!-- ⚠️⚠️ Incomplete reports will be marked as invalid, and closed, with few exceptions ⚠️⚠️ --> <!-- in addition, please use search well so that the same solution can be found in the feedback, we will close it directly --> <!-- for convenience of differentiation, use FRPS or FRPC to refer to the FRP server or client --> **[REQUIRED] hat version of frp are you using** <!-- Use ./frpc -v or ./frps -v --> Version: 0.35.1 **[REQUIRED] What operating system and processor architecture are you using** OS: windows 10 CPU architecture: amd64 **[REQUIRED] description of errors** client -> frps -> [frpc -> nginx(windows v1.18.0)] -> web server proxy_protocol_version = v2 nginx error ``` *182 broken header: "  ü³򎫥ZW뇝ş½h՘!¾I«r1³D¿) +šXu÷+U¹>§!°Bzg°)$ú ~¾‹|‡Ž›• " À+À/À,À0̨̩ÀÀ œ  /" while reading PROXY protocol, client: 127.0.0.1, server: 0.0.0.0:443 ``` **confile** <!-- Please pay attention to hiding the token, server_addr and other privacy information --> frpc ``` [web-1] type = http local_ip = 127.0.0.1 local_port = 80 custom_domains = xx.cn [web-2] type = https local_ip = 127.0.0.1 local_port = 443 custom_domains = xx.cn proxy_protocol_version = v2 ``` nginx ``` server { listen 443 ssl http2 proxy_protocol; set_real_ip_from 127.0.0.1; real_ip_header proxy_protocol; real_ip_recursive on; server_name xx.cn; ssl_certificate .xx.pem; ssl_certificate_key xx.key; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_prefer_server_ciphers on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_verify_client off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $proxy_connection; proxy_set_header X-Forwarded-Host $the_host; proxy_set_header X-Forwarded-Proto $the_scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; add_header Strict-Transport-Security max-age=31536000; add_header X-Content-Type-Options nosniff; location / { proxy_pass http://xx; } } ``` **log file** <!-- If the file is too large, use Pastebin, for example https://pastebin.ubuntu.com/ --> **Steps to reproduce the issue** 1. 2. 3. **Supplementary information** **Can you guess what caused this issue** **Checklist**: <!--- Make sure you've completed the following steps (put an "X" between of brackets): --> - [] I included all information required in the sections above - [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/fatedier/frp/issues?q=is%3Aissue)
Author
Owner

@RockyLOMO commented on GitHub (Feb 22, 2021):

个人配置问题, 有效!

<!-- gh-comment-id:783247438 --> @RockyLOMO commented on GitHub (Feb 22, 2021): 个人配置问题, 有效!
Author
Owner

@smallfish01 commented on GitHub (Mar 18, 2022):

您好,我也碰到了同样的问题,请问您是如何解决的?

谢谢!

<!-- gh-comment-id:1072070573 --> @smallfish01 commented on GitHub (Mar 18, 2022): 您好,我也碰到了同样的问题,请问您是如何解决的? 谢谢!
Author
Owner

@peaceanddemocracy commented on GitHub (May 30, 2022):

我这边启用了proxy_protocol之后直接显示404报错,不知道要怎么搞

<!-- gh-comment-id:1141105334 --> @peaceanddemocracy commented on GitHub (May 30, 2022): 我这边启用了proxy_protocol之后直接显示404报错,不知道要怎么搞
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#1792
No description provided.