[opencms-dev] 404 errors with multi-site static export

Christian Steinert christian_steinert at web.de
Tue Feb 7 11:45:09 CET 2012


Dear All

in general, static export works very well. However, there seems to be  a problem when exporting template resources with static export after publish, as soon as some of these resources don't belong for the default site.

For examle if there are two sites: /sites/default and /sites/other then the template resources of /sites/default will be exported properly but the resources in /sites/other will generate 404 errors in the static export logs.

The reason seems to be the way how the requests that trigger the export are generated and handled.
- For triggering export requests, opencms uses the url prefix that is configured in opencms-importexport.xml. This setting can be changed but the default setting looks like this: <exporturl>http://127.0.0.1:8080${CONTEXT_NAME}/handle404</exporturl>
- When handling the request, opencms will look at the host name of the request - for example 127.0.0.1. Opencms will then switch to a site that corresponds to this server name. All processing will be performed within this site, no matter to which site the export request belongs.

This means that when opencms tries to export template resources it will always look for them in the default site. If the resource actually belongs to a different site then it will not be found and the export will fail with an error. I have found an old description of this problem which seems to come from the time of opencms 6 and I myself could reproduce the problem with opencms 7.0, 7.5 and 8.0.4.

If there is interest, I could open a bug report and try to write a patch. For normal requests it is completely ok that opencms choses the site based on the requested host name. But since opencms already has special handling for export requests, I think it would be proper to change the 404-related code path in such a way that the system first determines to which site the requested resource belongs before continuing the export.

Alternatively, if anybody knows a working solution or workaround for this problem, I would be very interested.

Thanks!
Christian





More information about the opencms-dev mailing list