frp icon indicating copy to clipboard operation
frp copied to clipboard

[Feature Request] 是否可以将http和https绑定到相同端口?

Open chingxuds opened this issue 2 years ago • 3 comments

Describe the feature request

如题,是否可以将http和https绑定到相同端口,依据域名进行服务区分。

Describe alternatives you've considered

No response

Affected area

  • [ ] Docs
  • [ ] Installation
  • [ ] Performance and Scalability
  • [ ] Security
  • [ ] User Experience
  • [ ] Test and Release
  • [ ] Developer Infrastructure
  • [ ] Client Plugin
  • [X] Server Plugin
  • [ ] Extensions
  • [ ] Others

chingxuds avatar Jul 20 '22 06:07 chingxuds

莫名其妙

请补充一下使用场景

前端http默认80 https默认443 这个不用管

非标的话还要绑域名,是不是有点多此一举

tcp映射后端nginx把http和https配置写一块就行了

Becods avatar Jul 20 '22 09:07 Becods

莫名其妙

请补充一下使用场景

前端http默认80 https默认443 这个不用管

非标的话还要绑域名,是不是有点多此一举

tcp映射后端nginx把http和https配置写一块就行了

是这样的,我在云主机上搭建了frps,通过nginx作泛域名反向代理。 现在http和https因为是两个不同的端口,需要反代两次,而泛域名无法知道哪个服务需要使用http,哪个需要使用https,就只能先尝试https,失败后再试http。 如果是同一个端口,则只需要反代一次就足够了。

chingxuds avatar Jul 20 '22 09:07 chingxuds

莫名其妙 请补充一下使用场景 前端http默认80 https默认443 这个不用管 非标的话还要绑域名,是不是有点多此一举 tcp映射后端nginx把http和https配置写一块就行了

是这样的,我在云主机上搭建了frps,通过nginx作泛域名反向代理。 现在http和https因为是两个不同的端口,需要反代两次,而泛域名无法知道哪个服务需要使用http,哪个需要使用https,就只能先尝试https,失败后再试http。 如果是同一个端口,则只需要反代一次就足够了。

你那个https在nginx校验就行了啊。为什么要在frps上走证书?例如:nignx 配置

server
{
    listen 80;
		listen 443 ssl http2;
    server_name ~^(?<subdomain>.+).demo.com$;
 ssl_certificate    /www/cert/fullchain.pem;
    ssl_certificate_key    /www/cert/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    add_header Strict-Transport-Security "max-age=31536000";
    error_page 497  https://$host$request_uri;
 location ~/ {
      proxy_set_header Host $host;
      proxy_pass http://frps的ip+端口;
    }
}

这样不需要frps的443端口

fuyoo avatar Jul 28 '22 01:07 fuyoo

Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.

github-actions[bot] avatar Aug 28 '22 00:08 github-actions[bot]