Can't get docker xwiki to run at non-root url path

I found https://jira.xwiki.org/browse/XDOCKER-74, which brings up the same problem, but I couldn’t figure out how to implement the suggestions.

I have an apache server which is proxy-ing /wiki address to an xwiki docker container.
The reverse proxy directive in apache is the same as the proxy. /wiki host:port/wiki

After messing with tomcat’s contexts without success, I decided just to brute force it.

I pulled the xwiki docker from github and changed all the webapps/ROOT to webapps/wiki in the Dockerfile.

I did the same for the docker-entrypoint.sh file.

I built the images and spun up the containers without error.
I confirmed that the tomcat/webapps folder of the container contains a “wiki” app folder and not “ROOT”.

I can hit the wiki by typing wiki/bin/distribution into the address bar. The apache proxy is working, and so is the deployed app.

However, any link I click on in an xwiki page is still using root base path “/”. It will try /bin/distribution or whatever and not hit the /wiki path. Also, none of the css is working for the same reason. It’s looking for it at the wrong url.

I’ve tried many different combinations of approaches fiddling with tomcat with no luck. I’d love a definitive tutorial for this.

What does the xwiki.webapppath setting do in the docker?-entrypoint.sh do? I set it to “wiki” and “”. It didn’t seem to affect my problem.

I’ll try to work on that.

I’ve now implemented support for configuring the context path.

See https://jira.xwiki.org/browse/XDOCKER-74?focusedCommentId=104179&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-104179

Documented at:

Once the PR is applied, would be great if you could let me know if it works fine for you.

IMPORTANT: Make sure you read the fine prints at https://github.com/xwiki-contrib/docker-xwiki#configuration-options about modifying your local xwiki.cfg file.

Now merged! See last comments of https://jira.xwiki.org/browse/XDOCKER-74

Wow, I appreciate you merging that in so fast.

It partially works.

The CONTEXT_PATH did cause the app to install in the tomcat webapp directory as “wiki”.

However, xwiki doesn’t seem to use that as the base url for its links or resources. (See attached image)
The css is still linked from root and doesn’t render.
Links don’t use the /wiki/ prefix either so clicking on links leads to 404.

wiki_err .

I stopped the container.
I added the “xwiki.home” property to the xwiki.cfg file. I set it to be my-url/wiki.
I restarted the container.
Still the same problem.

I tried adding

RequestHeader set x-forwarded-host myrul/wiki

to the apache configuration as well. Still no luck.

Your docker setup is fine, but I can’t figure out how to pair that with the xwiki config so xwiki’s internal link writing works.

You should remove this property (comment it out). It’s better to let xwiki figure it out. It’s only needed when you deploy as ROOT.

In my tests I only tried with “xwiki”, not “wiki”. Maybe you could try with “xwiki” to see if it helps (again make sure to remove the webapppath property from the xwiki.cfg file in your local permanent directory).

I don’t use an apache front end so I don’t know how to configure this but it should be pretty simple and there are some docs about it on xwiki.org I think.

You sir, are a hero. Changed it “xwiki” and removed config options and it worked like magic.
A little disappointing I couldn’t get it to work for an arbitrary endpoint, but not a big deal.

Ok so I’ll also try it with “wiki” and see what’s wrong. Thanks

@queuey1 I’ve just tested with “wiki” and it works very well. I think your issue is with configuration of your front end (your apache or ngingx server in front of xwiki).