fjudith / docker-draw.io

Dockerized draw.io based on tomcat:9-jre11 & tomcat:9-jre8-alpine official image.
Apache License 2.0
404 stars 481 forks source link

DRAWIO_BASE_URL parameter not working with bind-mounted PreConfig.js & reverse proxy #46

Open lunacite opened 3 years ago

lunacite commented 3 years ago

Base URL customization per this issue is not working, the following files still attempt to load from the root instead of the noted subdirectory (/diagram): croppie.min.css grapheditor.css PreConfig.js apple-touch-icon.png favicon-16x16.png

Nginx location block

location /diagram { # begin diagram block
        auth_request /auth-4;
        proxy_pass  https://diagram-url:8443/;
        add_header X-Frame-Options "SAMEORIGIN";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
} 

Docker-compose.yml

version: '3.5'
services:
  drawio:
    image: fjudith/draw.io
    container_name: drawio
    restart: unless-stopped
    ports:
      - 8080:8080
      - 8443:8443
    environment:
      PUBLIC_DNS: example.org
    volumes:
      - ./config/PreConfig.js:/usr/local/tomcat/webapps/draw/js/PreConfig.js

PreConfig.js

/**
 * Copyright (c) 2006-2019, JGraph Ltd
 * Copyright (c) 2006-2019, draw.io AG
 */
// Overrides of global vars need to be pre-loaded
window.EXPORT_URL = '/export'; //This points to ExportProxyServlet which uses the local export server at port 8000.
//This proxy configuration allows https requests to the export server via Tomcat.
window.PLANT_URL = 'REPLACE_WITH_YOUR_PLANTUML_SERVER';
// window.DRAWIO_BASE_URL = 'https://mcp.lunacite.com/diagram';
// window.DRAWIO_VIEWER_URL = 'https://mcp.lunacite.com/diagram/js/viewer.min.js';
window.DRAW_MATH_URL = 'math';
window.DRAWIO_CONFIG = null; //Replace with your custom draw.io configurations. For more details, https://desk.draw.io/support/solutions/articles/16000058316
zyzzyxdonta commented 2 years ago

Did you get it to work? I'm facing the same problem at the moment.

delameter commented 1 year ago

My "solution" was to use a separate subdomain for this, and also to give up attempts to make export-server and plantuml-server work.

zyzzyxdonta commented 1 year ago

Alright, I just went with a different port 😅 We're mainly using DrawIO from within a MediaWiki so it doesn't really matter that the URL looks a bit off.

JoghurtMitDerEcke commented 1 year ago

I have found a solution that works for me. Maybe it will help someone else too.

See #3175 or my comment https://github.com/jgraph/drawio/issues/3175#issuecomment-1544297540