Passing static content is rather boring. Using FIT in front of your own website is where the fun begins. Let’s integrate a real website. In the following, we will be using the site example.com. Replace “example.com” with the host name of your own website if you like.
For this example, we extend the example project
In the following, all non-absolute file paths are relative to the default site’s base directory, that is
First, you have to allow FIT to load data from the origin server. Therefore, create an ACL file
conf/acl.xml that grants access to the remote host:
<acl> <allow url="//example.com" /> </acl>
Next, you need to enhance the URL map in
conf/urlmap.xml to get nice and readable URLs. Here, we map the remote server to our local
/ path whereas local files of the
public folder are now accessible via
<urlmap> <map path="/local/" source="fit://site/public/" /> <map path="/" source="//example.com/" /> </urlmap>
The sources configuration in
conf/sources.xml is used to modify requests sent to the origin. Pass the origin headers with the keyword auto.
If the origin website relies on cookies, you probably want to pass cookies in transparent mode:
<sources> <source host="example.com"> <headers pass="_auto_" /> <cookies mode="transparent" /> </source> </sources>
Point your browser to the FIT server at http://local14.sevenval-fit.com/ and look at the result: The origin website is now loaded via FIT.
If you use AJAX to load HTML fragments, you should enable automatic fragment handling:
<config> <content-handling> <retain-html-fragments/> </content-handling> </config>