XWiki Docker Image with Short URLs

Hello,

I thought I already posted this, but apparently I haven’t…

On Github, I have a repo that I forked from Horten Folkeverksted’s repo, that builds a Docker image supporting URL rewriting. The repo I forked hadn’t been touched since sometime in 2021. My goal is to maintain the repo, adding new XWiki version/servlet container/database combos as requested.

It currently supports the environment in which I run my own wiki: XWiki 15.5.0 + MariaDB + Apache Tomcat. If you’d like me to add wiki/servlet/database combos, just ask! If you don’t want to wait for me, please fork and open a pull request. Either way, PLEASE open an issue first.

https://github.com/lobosstudios/xwiki_urlrewrite

I hope lots of people find this useful.

Best
–Steve

Hello @stevesobol,

Are you sure your solutions is working? IIRC the UrlRewriteFilter - Rewrite URL's in Java Web Application Servers is not compatible with Tomcat 9+, see Not compatible with Tomcat 9 · Issue #246 · paultuckey/urlrewritefilter · GitHub. I don’t see your Dockerfile to use an XWiki image with Tomcat8.
So, how’s your project handling the Short URLs?

Thanks,
Alex

It seems to be working fine for me. Granted, my sample size is very small (only one wiki).

I said I wasn’t using Tomcat 8 (in the comment that I deleted), but I’m actually not sure. I will check.

Checking Tomcat’s logs: I’m using 9.0.76.

1 Like

Could you try to upload some file? Can you reproduce the behavior described in Attachment upload fails?

I will, as soon as I can.

I’m getting errors when I try to upload attachments. I’ll have to check the logs

I think I got this to work by opening a shell in my docker image and editing the tomcat config directly… not the best but it seems to work including file uploads.

All it takes is following some of the short url steps

In xwiki.cfg

xwiki.defaultservletpath=
xwiki.showviewaction=0

in web.xml add

<servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>/*</url-pattern>
</servlet-mapping>

And then you just need to redirect / to /Main or whatever your homepage is. I am using nginx so

location / {
  rewrite ^/$ /Main break;
  # rest of proxy pass stuff...
}

Btw that page is sort of a mess and i’d be happy to help edit it, not sure what it takes to get edit access to xwiki docs tho.

This is indeed the recommended way ATM, see https://github.com/xwiki/xwiki-docker#configuration-options

If you need to perform some advanced configuration, you can get a shell inside the running XWiki container by issuing the following (but note that these won’t be saved if you remove the container):

docker exec -it <xwiki container id> bash -l

Could you explain what sort of mess you’re referring to? :slight_smile:

To get edit access is easy, you just need to register on xwiki.org. See:

Thanks!