structurizr / lite

Structurizr Lite
https://docs.structurizr.com/lite
MIT License
226 stars 26 forks source link

Support for running in path (e.g. example.com/structurizr) #123

Closed jrencz closed 3 months ago

jrencz commented 4 months ago

Description

I tried to configure the structurizr/lite as said in https://docs.structurizr.com/onpremises/configuration#structurizrproperties (I am aware it's a link to on-premises docs, but it does work the same here), with one change: instead of just a hostname, I set structurizr.url to hostname with some path

Most assets were prefixed with both the hostname and the path correctly (but for the icon, maybe some others, I didn't pay attention to that) but there were some parts of UI, like

<script nonce="${scriptNonce}">$('#homeButton').click(function() { window.location.href='/'; });</script>

https://github.com/structurizr/ui/blob/f06260f1f0e6ac33b5972440150dccf2a4753053/src/fragments/diagrams/controls.jspf#L12C21-L12C126

which have addresses hard-coded so they didn't work.

There's also api calls that fail around here:

https://github.com/structurizr/lite/blob/3e77bc1f8a0b71c1be307854cefa98d189695701/src/main/java/com/structurizr/lite/web/ApiController.java#L120-L124

as far as I understand that's because not all calls are correctly prefixed. This makes instance unusable when run that way.

Should that work? Is it a valid use of structurizr.url?

Priority

I have no budget and there's no rush, please add this feature for free

More information

What I actually tried to do was to run more than one instance as docker containers with nginx on top of them so that it's possible to preview many workspaces at a time.

simonbrowndotje commented 3 months ago

Lite isn't designed to work from anything other than the root (/) I'm afraid. The UI code is shared between Lite, the cloud service, and on-premises installation, so this isn't something I want to change/support either. Sorry!