structurizr / onpremises

Structurizr on-premises installation
https://docs.structurizr.com/onpremises
MIT License
117 stars 45 forks source link

Supporting paths when deployed behind a reverse proxy #111

Closed wterpstra closed 3 months ago

wterpstra commented 3 months ago

Description

I'd like to deploy the structurizr on-premises application behind a reverse proxy but on a path, for example on https://example.com/diagrams/*. It won't work as when I send the X-Forwarded-Prefix prefix with a value of /diagrams/ it will be ignored.

I had a look at the code of both the on-premises repo as the UI repo, and I think this can be implemented by including the ForwardedHeaderFilter bean and then prefixing any links that do not use the CDN URL with the pageContext.request.contextPath property.

I'm very eager to get this working and have already done a little PoC to see if this could work. If you agree I'm happy to move forward with this work.

Priority

I'm willing to add this feature myself and raise a PR (please confirm approach first)

More information

No response

simonbrowndotje commented 3 months ago

The on-premises installation wasn't designed with this in mind, and it's not something that I want to support I'm afraid as it will require similar changes to Lite and the cloud service, since all share the same UI code. You're welcome to fork the repo(s) though.

wterpstra commented 3 months ago

Hi @simonbrowndotje thanks for your reply. I don't think the changes in the UI project will be conflicting there. I mostly prefixed existing URLs with the pageContext.request.contextPath, if thats null or empty (which is probably the case with lite and cloud without making any changes) it won't prefix the URLs and shouldn't get in the way.

I'll test my changes with the lite repo to verify. If it works I'll make a draft PR for you to review if you want. If you're happy with it then by all means please merge, but no offense taken if you don't want to :)