WebHare community

Exporting WebHare site for servicing on Apache server

Dear WebHare community,

Using WebHare, a small website is created for a research group. The content is quite static, although some of it is provided by other systems (using jquery.js to include it). Currently, the site is hosted by using the WebHare container for docker, but the site needs to move to a server that is more reliable (better uptime, less interference from other applications).

It would be nice if the content of the WebHare site could be exported, such that it can be serviced by an Apache server. The content in the output/hostname directory seems to be suitable for that, but it is unclear whether that is complete and what functionality would be missing (probably handling of forms). Is such export functionality available?

The reason to ask: for hosting, we have the following options:

  • Using a service provider (like the Dutch HostNet). For web hosting, it provides the standard tools (Apache, mysql, php, node.js), but doesn’t support Docker containers, like the one provided by WebHare.
  • Using a VM based solution, where we have full control over the system and can install Docker or WebHare. The VM allows easy host migration for better uptime, but at a higher cost (monthly fee and system maintenance of the VM).
  • Using a dedicated (physical) server to run WebHare, which introduces additional maintenance overhead, but might be more cost effective depending on the monthly fee of a VM.

The first option (web hosting using Apache) would be the most convenient. The website would be maintained on a separate server (without the uptime and public access requirements) and synchronized towards the Apache server. Is this feasible? If so, what are the restrictions w.r.t. functionality?

Kind regards,
Richard Verhoeven

The first option (web hosting using Apache) would be the most convenient

I think the only convenient way to do that is to use a website mirroring tool, to make sure you pick up everything that is needed. And you would still lose forms and the url history.

The website would be maintained on a separate server (without the uptime and public access requirements) and synchronized towards the Apache server.

Perhaps you could setup the Apache server to reverse-proxy a hostname to the original server? It then only needs to let that server access it

All our production setups use a similar setup, although with nginx as reverse proxy instead of Apache, which also allows us to serve multiple WebHare installations on a single IP (https://gitlab.com/webhare/proxy)

(and it’s currently also the only way to provide SNI, ie multiple certificates on a single IP)

With a RewriteRule directive in .htaccess of the Apache server, it is possible to reverse-proxy most of the content, although I didn’t test everything yet. However, the content still contains references to the WebHare server, which would by-pass the Apache server.

For example, in the settings of the site in WebHare Publisher, the host in Output URL would be private.example.com (where WebHare would run), while the host in Production URL would be public.example.com (where Apache would run). In the generated HTML code, it would always use the Output URL and not the Production URL. Through the Apache server, a browser can get the initial document from public.example.com, but it would contain direct references to private.example.com. For images and style files, it is possible to specify the CDN base URL, but that doesn’t apply to links in RTD based documents.

Is there a procedure to activate the use of the specified Production URL?

Why not rename the webserver private.example.com to public.example.com in WebHare ? Then it can publish using the proper full URLs and all other functionality (such as Goto URL) will work properly too

The Production URL does something different - it’s there to record the URL of the public version of a site if we have a local copy on which we’re testing so that we can use public URLs in Goto URL on our test/development servers, and still go to the proper place. It makes having separate but often-synced test & production vesions of a WebHare server a lot more convenient, but it doesn’t affect URL generation

When I tried renaming private.example.com to public.example.com, the Apache proxy would forward to private.example.com. At that point, the WebHare server on private.example.com would not service the incoming requests, as it refers to an unknown virtual host. Setting the request header “Host” didn’t seem to have any effect, although that might be an issue with the Apache configuration. I’ll give it another try.

Does Apache require the forwarded-to hostname to be different ?

Perhaps you could set up private.example.com as a non-redirecting alias for public.example.com in WebHare so it will listen to that name too