Site Configuration: Fine-tuning Ghostlab Internals
You can configure every site in Ghostlab with various settings. When you click on the settings icon (cog) of a site, its settings will pop up in the tray. The site settings – as well as the preprocessor settings and the application preferences – can be full-text searched. Note that you need to type at least 3 characters for the search to take place. Also, site settings and application preferences are grouped into basic and advanced settings. The advanced settings are located at the bottom and only become visible when you expand them.
The base settings let you adjust the site title, the site URL or Directory (where the content is fetched from), and a startup path. The site title is automatically parsed from the index document – but you can override it at any time. The startup path is a relative path that is added to the Ghostlab server URL whenever you open the site in a local browser (e.g. if you always want to launch some/document/at/a/subpath/test.html, set this as the startup path).
Ghostlab can watch a directory for changes to files with certain extensions and automatically trigger a reload on all clients if any matching file changes. For directory-based sites, file watching is automatically enabled and watches for changes to html, css and js files. The directory watched for changes is the site directory.
You can enable file watching for URL-based sites and point the watch file directory to any local folder, or you can disable file watching for local sites. When you are using preprocessors (e.g. sass compiling), the relevant extensions (e.g. .scss) are automatically added to the watch file list.
In the Content Loading tab, you can specify how Ghostlab clients load their resources. There are two options.
If you choose to load all content through Ghostlab, all URLs to resources will be rewritten so that they are loaded through Ghostlab. This is helpful if resources have a restriction on the referer – a good example are Typekit fonts. If you do not load Typekit fonts through Ghostlab and do not configure them to be served via your Ghostlab IP, they will not show up. If you choose to load them through Ghostlab, they will. Note that loading all resources through Ghostlab will have a performance impact, since all the clients will load all content through one single server.
If you choose to append a random query parameter, Ghostlab will cause clients to add a query parameter to all the resources they request (as long as they match the extensions you are free to provide). By doing this, these resources will bypass the browser cache. Make sure you check this option if you want to force your clients to always reload the resources.
Caching and Logins
In the caching and logins section, you turn off or on content caching and fine-tune the way in which Ghostlab handles cookies. This is especially relevant if you are working with sites that require users to login.
In the HTTP headers section, you can add or remove headers from the requests and responses made by this site. Note that in the general settings, you can set which default headers are added to or removed from the requests and responses of any new site.
In the action column, you can specify whether the header in question should be added to or removed from the request or response. In the type column, you can specify whether the setting or unsetting of the header applies to the requests to or the responses from this site.
You can also add an HTTP auth header. If you have a site that is password protected via the .htaccess file, you can conveniently set the username and password that all devices connecting to the site via Ghostlab will use – no need to type in these details on every device!
In the cookies section, you can add, replace or remove individual cookies based on your needs. This can be helpful in many contexts, and can for example serve to provide authentication cookies to a site you are testing on, but that requires single-sign-on authentication (something Ghostlab currently cannot handle on its own).
In the file charset section, you can specify in which encoding your files are saved. Note that this only applies to sites that are based on a local folder.