-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MagicMirror loading fails behind reverse proxy after upgrading to v2.29 due to missing environment variables #3613
Comments
thanks, we should have a test for this ... |
but I have no idea for this without a reverse proxy ... |
fixes #3613 wanted to write a test for `basePath` but have no idea at the moment to simulate this without a reverse proxy. Here my test setup for documentation: ```yaml networks: proxy: driver: bridge services: socket-proxy: privileged: true image: tecnativa/docker-socket-proxy:edge container_name: socket-proxy restart: unless-stopped volumes: - /var/run/docker.sock:/var/run/docker.sock:ro environment: CONTAINERS: 1 ports: - "127.0.0.1:2375:2375" networks: - proxy traefik: image: traefik:latest container_name: traefik restart: unless-stopped user: 1000:1000 command: - "--providers.docker=true" - "--providers.docker.network=traefik_proxy" - "--providers.docker.endpoint=tcp://socket-proxy:2375" - "--entryPoints.http.address=:80" - "--global.sendAnonymousUsage=false" - "--log.level=INFO" - "--api=true" - "--api.dashboard=true" # - "--accessLog=true" # - "--accesslog.fields.defaultmode=keep" # - "--accesslog.fields.headers.defaultmode=keep" networks: - proxy ports: - "80:80" magicmirror: image: karsten13/magicmirror:develop container_name: mm restart: unless-stopped entrypoint: - sleep - infinity networks: - proxy labels: - "traefik.http.services.karsten13.loadbalancer.server.port=8080" - "traefik.http.routers.k13-http.service=karsten13" - "traefik.http.routers.k13-http.entrypoints=http" - "traefik.http.routers.k13-http.rule=Host(`localhost`) && PathPrefix(`/testbasepath`)" - "traefik.http.middlewares.k13-stripprefix.stripprefix.prefixes=/testbasepath" - "traefik.http.routers.k13-http.middlewares=k13-stripprefix" ```
so, i created a simple proxy it works for whatever I code to use the port (config +10) server.js if(process.env.mmTestMode === 'true' ){
const httpProxy = require('http-proxy')
var proxy = httpProxy.createProxyServer({});
//
// proxies the request, but removes the basePath as we are in the same location
// this is just for testing the basePath function
//
console.log("setup proxy server")
http.createServer(function (req, res) {
// This simulates an operation that takes 500ms to execute
const requestedUrl = req.url;
console.log("proxy for="+requestedUrl);
if(config.basePath.length>1 && requestedUrl.startsWith(config.basePath)){
req.url=requestedUrl.slice(config.basePath.length)
}
// send the request to the normal port
proxy.web(req, res, {
target: 'http://localhost:'+port
});
}).listen(port+10);
} |
log of requests thru proxy... only socket.io uses the basePath prefix
|
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.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.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
toin order to make my application work again. Probably needs further refinement and exception handling.
The text was updated successfully, but these errors were encountered: