Xwiki 11.2, failed to save page

Hi, sorry for my bad english.

I’m a newbie using xwiki. I have installed xwiki on a kubernetes cluster using the image “xwiki:stable-mysql-tomcat”. The wiki is plugged to an external mysql database.

When I create a page and click on “save” or “save and close”, This error is raised:

Failed to save the page. Reason: Server not responding

BUT the document is saved correctly.

In the browser’s console:

VM8186:1 Mixed Content: The page at ‘https://xxxx/bin/edit/XXX/XXX/XXX/XXX/WebHome?template=Help.Templates.tpl_urls.WebHome&parent=XXXX.XXX.XXX.WebHome&title=Urls’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://XXXXXX/rest/jobstatus/refactoring/create/1554455934213-109?media=json

To access to the wiki, I have an ingress based on traefik that make an http redirect to https and folow requests to the pod. The pod is running in HTTP port 8080.

In the wiki.cfg I have set the protocol to “https” but it does not help.

[EDIT] It seems that the problem appears just when I create new pages only. If I edit a page, I have no problem (at the moment).

Any idea ??

Hi @rissany!

Basically this problems means that something is wrongly configured in front of XWiki: somehow the request that goes to Tomcat is considered as an http one, where it should be an https.

I can’t help you much there since it’s not related to XWiki and I don’t know anything about ingress and trafeik, but try to google a bit about configuring those for https and tomcat.

Hope that helps.
Simon

Ok so I’ll try another approach. is there a way to use an HTTPS connector on the tomcat in the “xwiki:stable-mysql-tomcat” image ?

traefik is a reverse proxy and transmit all requests using http to tomcat adding with some headers to tell
tomcat that the protocol to use is https. Unfortunately tomcat seems to not use these headers (x-forwarded-proto etc.). If I change the communication to https, maybe it will solve the problem.

I can’t understand why the message appears just on creation page and not on update…

If by update you mean when editing an already existing page, that’s because in that case we don’t use the same mechanism as when creating the page, so we don’t get such URL from tomcat. Now you might encounter the issue at several places in the wiki, not only when creating a page.

The xwiki tomcat image is based on tomcat8 docker image, see: https://github.com/xwiki-contrib/docker-xwiki/blob/master/11/mysql-tomcat/Dockerfile#L20

So you should look how to do that directly for the tomcat8 docker image: you should be able to use the same mechanism for XWiki.

Ok I have to build my own image from the official one …

Why? What’s missing in the xwiki official image?

The way to configure https is inside the xwiki config files (see https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Configuration/#HReverseproxysetup for ex ) and those are available on your host since they’re volume-mounted (the xwiki permanent directory is mounted in the docker run command).

I’ve already set thes opions in xwiki.cfg with no luck:

xwiki.home=https://xxxxx/
xwiki.url.protocol=https

The server.xml of tomcat has just 2 connectors. One using http port 8080 and another one for ajp. Nothing for https.

Ok but that wasn’t my question :slight_smile:

My question was:

The possibility to start a ful https connector. By default there are HTTP and AJP connectors.

The url.protocol doesn’t seems to solve my problem. So the test I would like to do is to start a tomcat https connector and configure my reverse proxy to use it. I didn’t find anything to do that natively with the official image.

ok I see. You should be able to do that by mounting a volume at the right location on the container side to provide your own context.xml or server.xml. Beware that xwiki provides a context.xml in META-INF/context.xml in its WAR. See https://github.com/xwiki/xwiki-platform/blob/5df840d51f0d7929755b12143a90945f94e74438/xwiki-platform-core/xwiki-platform-web/src/main/webapp/META-INF/context.xml

I think that I doesn’t need tio put my own context.xml. I’ll export the default server.xml on my volume, add the connectors and certificates, and restart the pod.

@surli thanks. Indeed there are others pages that have the same problem. I’ll read the dockerfile

Have you been able to fix this problem? I see the same problem on xwiki 12.6
Blocked loading mixed active content “http://xwiki.mydomain.com/rest/jobstatus/refactoring/create/1598026825012-282?media=json”
I see the same problem when creating pages from the default templates.
I am running xwiki on k8s using the default nginx ingress.