Search code examples
gitlabplantuml

Plantuml diagrams not showing in Gitlab


Recently I noticed Plantuml diagrams stopped showing in our self-hosted Gitlab instance (only image placeholders). I am sure that it worked before, so first I checked the version of Gitlab and Plantuml (each running in a separate Docker container on a separate machine with separate address) if they needed any updates and found out that Gitlab was perhaps the latest, but not so Plantuml. So I upgraded the Plantuml container just to be sure. The current setup:

  • Gitlab 13.9
  • Plantuml 20210917-1448 / version 1202110

Nothing changed, still no images, so I started to dig through the web and stumbled upon these possibly relevant pages:

I checked whether it worked, but no, still no images, only placeholders on the pages, be it wiki or issues. I checked the Plantuml instance whether it was itself working and it did, the instance was rendering images correctly. So next I modified the Gitlab configuration according to the first link to contain the line gitlab_rails['env'] = { 'PLANTUML_ENCODING' => 'deflate' }. Now I can see that the links to the images on the Plantuml instance have changed from .../plantuml/... into .../plantuml/~1..., so the configuration took effect, but still I do not see any diagram images in Gitlab, still placeholders only. But when I click the placeholder, a new tab with the diagram image correctly rendered does pop up. Even copy/paste the hyperlink address of the diagram into a new browser tab works, surprisingly (for me) either with or without the ~1 header in the url.

What am I missing? Why aren't the images showing in the Gitlab interface, when the Plantuml instance is (apparently) working correctly?


Solution

  • Actually, just moments ago I found out that the problem probably lies in Chrome, because Firefox is displaying the diagrams without a fuss... ... Later on I found out that the cause was that Gitlab was running over HTTPS, while Platuml server was serving images over HTTP. So the solution is either to allow mixed content on Gitlab pages, or configure Plantuml server to serve images over HTTPS...