Any sub domain points to rocket.chat server

Description

Hi
I am new to Rocket Chat
After setting up nginx i can access the rocket chat server directly from the main domain and any other sub domain.
example:
I have the server pointing to a subdomain but it can be accessed via example.com and any other subdomain i got on that domain
Any one know what setting i need to add to the config, to lock it down to the subdomain ( sorry new users can only have 2 links :frowning: )

Server Setup Information

  • Version of Rocket.Chat Server: 3.13.2
  • Operating System: Raspberry Pi OS Lite
  • Deployment Method: Snap
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version:
  • MongoDB Version:
  • Proxy: nginx
  • Firewalls involved: No

Any additional Information

nginx config

# Upstreams
upstream backend {
    server 127.0.0.1:3000;
}

# HTTPS Server
server {
    listen 443;
   server_name https://chat.example.com;

    # You can increase the limit if your need to.
    client_max_body_size 200M;

    error_log /var/log/nginx/rocketchat.access.log;

    ssl on;
    ssl_certificate /etc/nginx/certificate.crt;
    ssl_certificate_key /etc/nginx/certificate.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don’t use SSLv3 ref: POODLE

    location / {
        proxy_pass http://backend;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

Hi!

Sorry on my phone - this is a weekend, I’m just rushing through the questions here.

Your server_name directive is wrong. Write just the domain, don’t include the protocol or path components. This is not the same as the site url or root url setting of rocketchat (and of many other applications).

In your case, it should just be server_name chat.example.com;.

Hi
Thanks for the reply
But removing the https:// from the directive causes the server not to be accessible

If https is not supposed to be there, is the issue then with my settings in cloudflare?

Still got the issue.
Anyone there can point me in the right direction?

Get it all working properly without cloudflare first.

Cloudflare just confuses things.