[GH-ISSUE #5010] using vhosthttps with nginx inside same dockernetwork #3944

Closed
opened 2026-05-05 14:30:44 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @Cr34t1ngH0p3 on GitHub (Oct 3, 2025).
Original GitHub issue: https://github.com/fatedier/frp/issues/5010

Hi @shabakett I currently are facing the same issue. I want to enable the server to serve http as well as https services via nginx.

For [https service] <-> [frpc] <-> [frps] <-> [nginx:433] <-> https://my.domain.com it is working with the configuration (/etc/frp/https.ini) below.

But I receive 502 Bad Gateway if I want to serve [http service] <-> [frpc] <-> [frps] <-> [nginx:433] <-> https://my.domain.com with this configuration (/etc/frp/http.ini). Can you share your final configuration?

Option 1 will not work for me as then I'm only able to serve http services on my local client.

/etc/frp/frps.ini:


[common]

bind_addr = 0.0.0.0

bind_port = 7000

proxy_bind_addr = 0.0.0.0

vhost_http_port = 7080

vhost_https_port = 7443

token = <my-token>

/etc/nginx/conf.d/tunnel.conf:


server {

    listen 443 ssl http2;

    listen [::]:443 ssl http2;

    server_name my.domain.com;



    ssl_certificate /etc/letsencrypt/my.domain.com/rsa/fullchain.pem;

    ssl_certificate_key /etc/letsencrypt/my.domain.com/rsa/key.pem;

    ssl_certificate /etc/letsencrypt/my.domain.com/ecc/fullchain.pem;

    ssl_certificate_key /etc/letsencrypt/my.domain.com/ecc/key.pem;



    ssl_trusted_certificate /etc/letsencrypt/my.domain.com/ecc/ca.pem;



    # Include SSL configuration

    include /etc/nginx/snippets/ssl.conf;



    # Include headers

    include /etc/nginx/snippets/headers.conf;



    # Important: Disable error and access log, so that no IPs get logged

    access_log  off;

    error_log off;



    location / {

        proxy_ssl_server_name on;

        proxy_ssl_name $host;

        proxy_ssl_verify off;

        proxy_pass https://127.0.0.1:7443;

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header Host $http_host;

        proxy_set_header cookie $http_cookie;

        proxy_set_header Proxy-Connection "";

        proxy_http_version 1.1;

        }

}

Originally posted by @MelBourbon in #3214

I try to set up a docker network with nginx and frps. Similar to @MelBourbon [https service] <-> [frpc] <-> [frps] <-> [nginx:433] <-> https://my.domain.com to another server is working, but

[https service] <-> [frpc] <-> [frps] <-> [nginx:433] <-> https://local_docker_frps does not. I always get
peer closed connection in SSL handshake while SSL handshaking to upstream, client: 172.30.0.1, server:
even with:

proxy_ssl_server_name on;
proxy_ssl_name $host; 
proxy_ssl_verify off;

I have no ssl_trusted_certificate, is this the problem? I mean, in my nginx config, I dont know to which https service the frpc links.
Does somebody know why it does not work? I read a lot about SNI, but also I cannot bring it to work with that.

Thank you for some hints.
Best

Originally created by @Cr34t1ngH0p3 on GitHub (Oct 3, 2025). Original GitHub issue: https://github.com/fatedier/frp/issues/5010 > Hi @shabakett I currently are facing the same issue. I want to enable the server to serve http as well as https services via nginx. > > > > For `[https service] <-> [frpc] <-> [frps] <-> [nginx:433] <-> https://my.domain.com` it is working with the configuration (`/etc/frp/https.ini`) below. > > > > But I receive `502 Bad Gateway` if I want to serve `[http service] <-> [frpc] <-> [frps] <-> [nginx:433] <-> https://my.domain.com` with this configuration (`/etc/frp/http.ini`). Can you share your final configuration? > > > > Option 1 will not work for me as then I'm only able to serve http services on my local client. > > > > `/etc/frp/frps.ini`: > > ``` > > [common] > > bind_addr = 0.0.0.0 > > bind_port = 7000 > > proxy_bind_addr = 0.0.0.0 > > vhost_http_port = 7080 > > vhost_https_port = 7443 > > token = <my-token> > > ``` > > `/etc/nginx/conf.d/tunnel.conf`: > > ``` > > server { > > listen 443 ssl http2; > > listen [::]:443 ssl http2; > > server_name my.domain.com; > > > > ssl_certificate /etc/letsencrypt/my.domain.com/rsa/fullchain.pem; > > ssl_certificate_key /etc/letsencrypt/my.domain.com/rsa/key.pem; > > ssl_certificate /etc/letsencrypt/my.domain.com/ecc/fullchain.pem; > > ssl_certificate_key /etc/letsencrypt/my.domain.com/ecc/key.pem; > > > > ssl_trusted_certificate /etc/letsencrypt/my.domain.com/ecc/ca.pem; > > > > # Include SSL configuration > > include /etc/nginx/snippets/ssl.conf; > > > > # Include headers > > include /etc/nginx/snippets/headers.conf; > > > > # Important: Disable error and access log, so that no IPs get logged > > access_log off; > > error_log off; > > > > location / { > > proxy_ssl_server_name on; > > proxy_ssl_name $host; > > proxy_ssl_verify off; > > proxy_pass https://127.0.0.1:7443; > > proxy_set_header X-Real-IP $remote_addr; > > proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; > > proxy_set_header Host $http_host; > > proxy_set_header cookie $http_cookie; > > proxy_set_header Proxy-Connection ""; > > proxy_http_version 1.1; > > } > > } > > ``` _Originally posted by @MelBourbon in [#3214](https://github.com/fatedier/frp/issues/3214#issuecomment-1425549823)_ I try to set up a docker network with nginx and frps. Similar to @MelBourbon `[https service] <-> [frpc] <-> [frps] <-> [nginx:433] <-> https://my.domain.com` to another server is working, but `[https service] <-> [frpc] <-> [frps] <-> [nginx:433] <-> https://local_docker_frps` does not. I always get `peer closed connection in SSL handshake while SSL handshaking to upstream, client: 172.30.0.1, server:` even with: ``` proxy_ssl_server_name on; proxy_ssl_name $host; proxy_ssl_verify off; ``` I have no ssl_trusted_certificate, is this the problem? I mean, in my nginx config, I dont know to which https service the frpc links. Does somebody know why it does not work? I read a lot about SNI, but also I cannot bring it to work with that. Thank you for some hints. Best
Author
Owner

@Cr34t1ngH0p3 commented on GitHub (Oct 5, 2025):

Adding

proxy_ssl_name   ${domainname};
proxy_set_header Host ${domainname};

solved it

<!-- gh-comment-id:3369212451 --> @Cr34t1ngH0p3 commented on GitHub (Oct 5, 2025): Adding ``` proxy_ssl_name ${domainname}; proxy_set_header Host ${domainname}; ``` solved it
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#3944
No description provided.