Integrating the Rails Preview into the GUI

The instructions in this section apply to Infopark CMS Fiona 6.7.3 or later. For other versions, please refer to the corresponding manuals (PDF).


To be able to preview pages generated by your Rails application in the editorial system, you first need to make sure that Infopark Rails Connector has been installed. Among other things, the connector provides a PageController responsible for generating the preview. Furthermore, a web server able to work as a reverse proxy is required, for example an Apache HTTP server.

The following steps illustrate by example how to configure the GUI, the Rails application, and the Apache HTTP server in order to integrate the preview.

Configuring the GUI

For the GUI to generate preview URLs that match the route mapping of the Rails application's PageController, the property railsMapping of the bean systemInfo in the configuration file WEB-INF/gui.xml needs to be set as follows:

<property name="railsMapping" value="/:id/:name" />

After changing its configuration, the GUI it needs to be redeployed and the CMS must be restarted:

$ cd FIONA/instance/instance-name
$ ./bin/rc.npsd deploy GUI
$ ./bin/rc.npsd restart

Configuring the Rails Application

Create a new environment, preview, by copying the file config/environments/production.rb to config/environments/preview.rb. Add the following line at the bottom of this file to make the Rails Connector display the draft versions of the CMS content:

RailsConnector::Configuration.mode = "editor"

Now create a new section, preview, in your database configuration and specify the database you intend to use for the preview environment.

Furthermore, it is essential that the web server passes the instance name to the Rails application server. If you use Apache webserver with Phusion Passenger, specify the instance name as the PassengerBaseURI in the webserver configuration:

PassengerBaseURI /instance-name

Configuring Apache Webserver

Communication between the browser and the GUI might look like cross-site scripting (XSS) to the browser. To avoid this, a webserver is placed as a proxy server between the client and the GUI/Rails. The server to which a request from the browser is directed, is determined by means of the URL prefix.

Please add the following entries to the Apache configuration file httpd.conf:

LoadModule proxy_module modules/
LoadModule proxy_http_module modules/

# ..

ProxyRequests Off
ProxyVia On

# GUI requests
ProxyPass /instance-name/NPS http://localhost:8080/instance-name/NPS
ProxyPassReverse /instance-name/NPS http://localhost:8080/instance-name/NPS

Please make sure that the proxy modules are enabled as shown in the example above. Proxy definitions must be placed outside a container to take effect globally.

For the changes to take effect, the Apache server needs to be restarted. This will change the GUI URL to http://gui-host:apache-port/instance-name/NPS. In particular, the preview is no longer available on port 8080 (default setting).