[GH-ISSUE #3362] 用nginx转发https请求给frp。 请求返回的location均为http。/Using nginx redirecting https requests to frp, all location in responses return as http. #2690

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

Originally created by @Pandar1Young on GitHub (Mar 15, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3362

Bug Description

参考文章:https://www.cnblogs.com/shook/p/12790532.html
https://community.tableau.com/s/question/0D54T00000aXDaeSAG/trusted-authentication-not-working-after-getting-trusted-ticket-redirecting-to-login-page

Nginx和FPRS在同一个服务器上, frpc在内网的windows上
Nginx/ frps are on same server, frpc on internal machine on windows system.

外网通过访问abc.com, 发送https的请求, 响应头返回的是http。
我们在一个saas平台(https)上镶嵌了一个iframe, chrome/edge不允许在iframe里镶嵌http的内容。CORS
image

Request URL:https://abc.com/vizportal/api/web/v1/auth/signin?path=/views/_0/sheet0?:embed=yes&siteUrlName=
Response Location:http://abc.com/en/embeddedAuth.html?path=/views/_0/sheet0?:embed=yes&siteUrlName=&siteLuid=&authSettings=DEFAULT

请问frps如何设置,才能返回https的请求?

frpc Version

0.45.0

frps Version

0.45.0

System Architecture

frpc = windows/amd64, frps= linux

Configurations

frps.ini
[common]
bind_port = 7000
vhost_http_port = 12369
vhost_https_port = 12399

dashboard_port=37500
dashboard_user=admin
dashboard_pwd=admin


frpc.ini
[common]
server_addr = abc.com
server_port = 7000

[http]
type = http
local_ip = 127.0.0.1
local_port = 80
custom_domains = abc.com


ngnix.conf
server {
listen 443 ssl;
ssl_certificate "/etc/nginx/ssl/abc.com.pem";
ssl_certificate_key "/etc/nginx/ssl/abc.com.key";
server_name abc.com;

  location / {
      proxy_pass http://x.x.x.x:12369;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_max_temp_file_size 0;
      proxy_redirect off;
      proxy_read_timeout 240s;
  }

  error_page 404 /404.html;
      location = /40x.html {
  }

  error_page 500 502 503 504 /50x.html;
      location = /50x.html {
  }

}
server {
listen 80;
server_name abc.com;
return 301 https://$server_name$request_uri;
}

Logs

nothing strange there

Steps to reproduce

...

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @Pandar1Young on GitHub (Mar 15, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3362 ### Bug Description 参考文章:https://www.cnblogs.com/shook/p/12790532.html https://community.tableau.com/s/question/0D54T00000aXDaeSAG/trusted-authentication-not-working-after-getting-trusted-ticket-redirecting-to-login-page Nginx和FPRS在同一个服务器上, frpc在内网的windows上 Nginx/ frps are on same server, frpc on internal machine on windows system. 外网通过访问abc.com, 发送https的请求, 响应头返回的是http。 我们在一个saas平台(https)上镶嵌了一个iframe, chrome/edge不允许在iframe里镶嵌http的内容。CORS ![image](https://user-images.githubusercontent.com/33281511/225276452-9c30cde8-6ac6-4479-9c71-44bee56fca3a.png) Request URL:https://abc.com/vizportal/api/web/v1/auth/signin?path=/views/_0/sheet0?:embed=yes&siteUrlName= Response Location:http://abc.com/en/embeddedAuth.html?path=/views/_0/sheet0?:embed=yes&siteUrlName=&siteLuid=&authSettings=DEFAULT 请问frps如何设置,才能返回https的请求? ### frpc Version 0.45.0 ### frps Version 0.45.0 ### System Architecture frpc = windows/amd64, frps= linux ### Configurations frps.ini [common] bind_port = 7000 vhost_http_port = 12369 vhost_https_port = 12399 dashboard_port=37500 dashboard_user=admin dashboard_pwd=admin ---- frpc.ini [common] server_addr = abc.com server_port = 7000 [http] type = http local_ip = 127.0.0.1 local_port = 80 custom_domains = abc.com ---- ngnix.conf server { listen 443 ssl; ssl_certificate "/etc/nginx/ssl/abc.com.pem"; ssl_certificate_key "/etc/nginx/ssl/abc.com.key"; server_name abc.com; location / { proxy_pass http://x.x.x.x:12369; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_max_temp_file_size 0; proxy_redirect off; proxy_read_timeout 240s; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } server { listen 80; server_name abc.com; return 301 https://$server_name$request_uri; } ### Logs nothing strange there ### Steps to reproduce 1. 2. 3. ... ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [X] Client Plugin - [X] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@Pandar1Young commented on GitHub (Mar 15, 2023):

尝试了各种做法, 都没成功, 麻烦熟悉的大佬给条明路

<!-- gh-comment-id:1469713042 --> @Pandar1Young commented on GitHub (Mar 15, 2023): 尝试了各种做法, 都没成功, 麻烦熟悉的大佬给条明路
Author
Owner

@fatedier commented on GitHub (Mar 15, 2023):

我猜这个和 nginx 和 frp 都没关系,你自己的服务里该返回什么就返回什么就好了。

<!-- gh-comment-id:1470080938 --> @fatedier commented on GitHub (Mar 15, 2023): 我猜这个和 nginx 和 frp 都没关系,你自己的服务里该返回什么就返回什么就好了。
Author
Owner

@Pandar1Young commented on GitHub (Mar 16, 2023):

我猜这个和 nginx 和 frp 都没关系,你自己的服务里该返回什么就返回什么就好了。

@fatedier 感谢。从你的答案理解下来, 这个是 frpc上的服务的问题, 和frp应用本身其实没关系。

<!-- gh-comment-id:1471595506 --> @Pandar1Young commented on GitHub (Mar 16, 2023): > 我猜这个和 nginx 和 frp 都没关系,你自己的服务里该返回什么就返回什么就好了。 @fatedier 感谢。从你的答案理解下来, 这个是 frpc上的服务的问题, 和frp应用本身其实没关系。
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#2690
No description provided.