Problem when fetching annotations "Failed:server not responding"

Right after switching my wiki to domain based I m getting “Failed:server not responding” error from Annotation macro (call to rest api ends in 404)
image

It s exactly this piece of code when fetching annotations via rest api in AnnotationCode/Script (section AnnotationApplication)
image

It just gets URL(just domain name) wrong. Is it known bug? Shouldnt $xwiki.getURL be used instead?

I don’t know much about xm.restURL API but wrong domains in generated URLs are often a sign that the domain is wrong in the wiki descriptor. You might want to check that it’s complete (it should be the complete domain name and not just the first part). You can access the wiki descriptor through the wiki index (by clicking on the hamburger button on the top right corner).

I narrowed the problem
xm.restURL gets data from DOM (data attributes on HTML tag) where in the data-xwiki-rest-url attribute there is double //
data-xwiki-rest-url="//xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome"
as opposed to this on the instance that works:
data-xwiki-rest-url="/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome"

any clues where this is coming from? wiki description including aliases seems to be ok.

Apparently same as https://jira.xwiki.org/browse/XWIKI-12360 but this seems closed

Not really the same actually. The problem with XWIKI-12360 was that the webapp path was / so concatenating it was producing a double / but in your case the webapp path seems to be /xwiki.

No idea where that extract leading / could come from right now, is there anything special in your setup ?

Finally found the the cause

In xwiki.cfg I recently added trailing “/” in

#xwiki.home=http://www.pgdenik.cz/

because I noticed in the comments that it was recommended. However it caused all the trouble and removing it did the trick.

image

xwiki 12.9, tomcat9, nginx installed on Ubuntu

OK great that you found the cause. Looks like a bug and even probably a regression, would be great if you could create an issue about that on https://jira.xwiki.org/browse/XWIKI.

1 Like

Thanks, bug issue created https://jira.xwiki.org/browse/XWIKI-18140

Thanks. Looks like an easy fix.