getumbrel / umbrel

A beautiful home server OS for self-hosting with an app store. Buy a pre-built Umbrel Home with umbrelOS, or install on a Raspberry Pi or any x86 system.
https://umbrel.com
Other
6.87k stars 508 forks source link

HTTPS issue when using Cloudflare Tunnel due to fixed HTTP protocol in axiosInstance #1842

Open diazmateus opened 3 weeks ago

diazmateus commented 3 weeks ago

When creating a tunnel with Cloudflare to expose my Umbrel instance, the tunnel creation works without problems. However, when using HTTPS, I face issues accessing the new URL. Since I am using HTTPS, all requests must be executed with HTTPS; otherwise, the browser blocks requests made via HTTP.

Identified Cause: After investigating and debugging the system, I realized that the issue occurs because, in the file /containers/app-proxy/utils/manager.js, where axios is instantiated, the HTTP protocol is being used as a fixed value instead of reading the variable from the constants defined in the const.js file.

Relevant Code: The code snippet where the issue occurs is as follows:

const CONSTANTS = require('./const.js');

const axiosInstance = axios.create({
    baseURL: `http://${CONSTANTS.MANAGER_IP}:${CONSTANTS.MANAGER_PORT}`,
    headers: {
        common: {
            "User-Agent": `${package.name}/${package.version}`
        }
    }
});

The issue is in the line:

baseURL: `http://${CONSTANTS.MANAGER_IP}:${CONSTANTS.MANAGER_PORT}`

As a suggestion to resolve the issue, the line could be modified to:

baseURL: `${CONSTANTS.APP_PROTOCOL}://${CONSTANTS.MANAGER_IP}:${CONSTANTS.MANAGER_PORT}`

I have submitted a pull request with the requested change: https://github.com/getumbrel/umbrel/pull/1841.