Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
4.33k stars 576 forks source link

Problem with uppercase characters in base path #6564

Open zpuskaric opened 4 days ago

zpuskaric commented 4 days ago

Bug (or feature) description: I decided to put MeshCentral behind nginx reverse proxy and under non-root base path like:

https://myhost.mydomain.org/AaBbCc

in nginx I was passing location:

location /AbBcC {
        proxy_pass http://127.0.0.1:4443/AaBbCc
        proxy_http_version 1.1;
        proxy_hide_header content-security-policy;      
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        # Inform MeshCentral about the real host, port and protocol
        proxy_set_header X-Forwarded-Host $host:$server_port;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
}

in MeshCentral config.json i had:

  "domains": {
    "": {
      "_title": "MyServer",
      "_title2": "Servername",
      "_minify": true,
      "_newAccounts": true,
      "_userNameIsEmail": true
    },
    "AaBbCc": {
      "title": "MC Server",
      "title2": "mine",
      "minify": true,
      "newAccounts": false,
      "userNameIsEmail": false,
      "certUrl": "https://127.0.0.1:443/"
    }

I would get login screen but after logging I would get error 404.

Steps to reproduce:

put uppercase characters in base path in nginx config file (in this case AaBbCc)

Expected behavior:

To log into Meshcentral domain

Resolution:

After some time I noticed that returned URL converted all characters to lowercase and the request would not pass nginx.

After changing all AaBbCc paths to aabbcc in nginx and Meshcentral config files everything would work as expected.

Might help someone saving some time and head scratching.

zpuskaric commented 4 days ago

Correction:

location /aAbBcC should be location /AaBbCc

si458 commented 4 days ago

fixed your formatting for you this is an nginx issue and not a meshcentral issue you should be using proxy_pass http://127.0.0.1:4443/ from what im aware because it will pass /AaBbCc to the backend when you visit it anyways