HauntedHost in a Sub Folder - CloudFront
If you want to use HauntedHost along-side some other AWS aspects (e.g. having other custom content on the same Domain Name), the process is pretty straight forward. There are two main steps: creating an Origin and creating a Behaviour
This guide assumes you already have an AWS account and a CloudFront Distribution.
Add HauntedHost Origin
The first step to enable content from HauntedHost is to create an Origin. From your CloudFront Distribution:
- Choose "Origins"
- Select "Create Origin"
- Enter your Hosting Domain in "Origin Domain"
- Leave "Origin Path" empty even if you are hosting in a sub-folder
- Choose a name of your choice, e.g. "HauntedHost Origin".
- Leave all other options default and select "Create Origin"
Add HauntedHost Behaviour
The next step is to create a behaviour for your Ghost service. The initial steps here will vary depending on if you want to host as a subfolder, or as the default path for your website.
From the "Behaviours" section of your CloudFront Distribution:
Sub-Folder Initial Steps
- Select "Create Behaviour".
- In "Path Pattern", enter the path you configured when signing up for HauntedHost, followed by an asterisk. E.g.
/blog/*
Otherwise, if you want to host in the "root" / path, open the "Default" behaviour and continue below
- For Origin, choose the HauntedHost Origin created in the previous section.
- For "Allowed HTTP Methods", select "GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE"
- For "Cache policy", choose "Managed-CachingDisabled"
- For "Origin request policy", choose "Managed-AllViewerExceptHostHeader"
- For "Response headers", choose "Managed-SecurityHeadersPolicy". If you have a preferred response header, you can use this here. This shouldn't interfere with Ghost.
- Leave all other settings at their defaults and press "Create Behaviour"
This will take a few minutes to update, but once complete, you should be able to access your Publication!