8 Commits

Author SHA1 Message Date
Chris Raible
fb6040fd0c Fixed "View site" and post previews in Ghost Admin (#60)
* Fixed "View site" and post previews in Ghost Admin

ref https://linear.app/ghost/issue/ONC-1097/preview-post-does-not-work-on-separate-ghostadmin-domains
ref https://linear.app/ghost/issue/ONC-1090/oss-issue-previewing-site-from-subdomain-admin-panel-results-in

In Ghost Admin, the frontend of the site is loaded in an iframe in a few places:
- The "View site" tab on the sidebar
- In post previews

Using the default docker setup in this repository, these iframes fail to load because of the `X-Frame-Options DENY` header that is added by Caddy. This fixes the problem by replacing `X-Frame-Options DENY` with a Content Security Policy that allows the site to be embedded in an iframe on the site's domain itself and on the admin domain, if configured.

* Update SecurityHeaders

Spaces -> Tabs

---------

Co-authored-by: James Loh <git@jloh.co>
2025-08-18 12:13:11 -07:00
Hannah Wolfe
9ef8319d83 Updated Caddyfile.example to clarify ActivityPub requirement (#37)
- ActivityPub only requires this redirect if you are using a www domain
2025-07-31 16:02:42 +01:00
Hannah Wolfe
82e6085bd7 Updated Caddyfile.example comments for clarity (#36)
- Added a section title to each block that can be uncommented, so that we can reference this in the documentation
- Removed the first comment line as that seems out of date and confusing
- Minor improvements to some language and spelling for clarity
2025-07-31 14:28:45 +01:00
James Loh
871504e5ad Caddy: Fix non-www -> www placeholder
no ref

- In this redirect instance we're redirecting from `example.com` -> `www.example.com` so can actually use `{$DOMAIN}` here
- We can't in the first line of this block because Caddy doesn't (as far as I can currently tell) let us do a regex on it before putting it in to config
2025-07-15 21:22:33 +10:00
James Loh
c6211c9493 Caddy: Add note about redirect requirement for ActivityPub
no ref

- Our ActivityPub framework lets users set their AP username to index@example.com and have Ghost on www.example.com (ie instead of having their AP user be index@www.example.com)
- To do this users _must_ redirect from the non-www domain -> the www domain as the AP protocol will do lookups on the non-www path to validate and communicate to that username on the web
- Without this AP will fail since domains can't communicate with AP as there wont be redirects for them to follow
2025-07-15 21:22:33 +10:00
James Loh
ceac2ed1c2 Caddy: Add option to have a separate Admin domain
- Our setup docs recommend having Ghost Admin on a separate domain from the content domain
- This lets users optionally set this up if they want whilst continuing to align Admin <-> content domain through templates
2025-07-15 21:22:33 +10:00
James Loh
b2a3d75490 Caddy: Migrate redirects to placeholders
- We want customers to now copy the example Caddyfile so this still gives people the option but also makes it easier for customers who don't want to redirect themselves
2025-07-15 16:21:12 +10:00
James Loh
8d0d565df9 Caddy: Move to more templated approach
no ref

- The goal here is to be able to provide more functionality to self-hosters through snippets and other segmented config
- Some customers run Admin <-> content domains on separate ones which our current config doesn't support
- Our current config also hardcodes a www redirect which complicates setups when you don't have that domain setup or don't even want it
- Moving to a default template customers will have to copy which includes snippets allows us to update these later on without breaking peoples setups
2025-07-15 15:44:28 +10:00