Skip to content

MagicMirror loading fails behind reverse proxy after upgrading to v2.29 due to missing environment variables #3613

@XTrandi

Description

@XTrandi

Platform: Raspbian GNU/Linux 11 (bullseye) on Raspberry Pi 2

Node Version: 22.11.0

MagicMirror² Version: 2.29.0

Description: After upgrading MagicMirror from v2.28.0 to v2.29.0 my web interface won't display anything. Turning on developer tools displays missing /env subpath resulting in an exception in loader.js / main.js and subsequent loading.
env_404-notfound

Steps to Reproduce: I use a nginx webserver, which uses a reverse proxy on /apps/MagicMirror to redirect it to hostname:8080. My config.js has the reverse proxy included.

let config = {
	address: "0.0.0.0",
	port: 8080,
//	basePath: "/",
	basePath: "/apps/MagicMirror/", 	// The URL path where MagicMirror² is hosted. If you are using a Reverse proxy
					// you must set the sub path here. basePath must end with a /
	...
};

Expected Results: As for previous versions socket.io uses the basePath to establish socket connection between client and server. The initial loading for loading environment variables should, too.

Actual Results: MagicMirror loading fails. As a workaround I modified loader.js to

  const res = await fetch(`${location.protocol}//${location.host}/` + config.basePath + `/env`);

in order to make my application work again. Probably needs further refinement and exception handling.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions