Skip to content
Murray edited this page Jan 15, 2016 · 4 revisions

This page demonstrates different ways you may wish to override the approot method.

Relative Approot

This will use no root at all. Keep in mind this will not work with emails and RSS feeds.

approot = ApprootRelative

Static Approot

Note absence of trailing slash

approot = ApprootStatic "http://localhost"

Scaffolding

Get a static application root from runtime configuration stored in the foundation datatype:

approot = ApprootMaster $ appRoot . appSettings

Approot based on request

This will get the approot from the request header host field:

import Network.Wai (requestHeaderHost, isSecure)

approot = ApprootRequest $ \_ r -> maybe ""
    (mappend (if isSecure r then "https://" else "http://") . decodeUtf8)
    (requestHeaderHost r)

The first and unused parameter here is the master site.

Clone this wiki locally