Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Offical apps | Community apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Ghost
  3. Title: Ghost 6.68+: "/edit" shortcut returns 404 because start.sh writes `admin` as a string

Title: Ghost 6.68+: "/edit" shortcut returns 404 because start.sh writes `admin` as a string

Scheduled Pinned Locked Moved Solved Ghost
3 Posts 2 Posters 195 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jrl-abstract27J
    jrl-abstract27J
    jrl-abstract27
    wrote on last edited by
    #1

    Hi,

    Since our Ghost apps were updated to 6.68 (now 6.69, package 4.200.0), adding /edit to a post URL (e.g. https://site.com/my-post/edit/) returns a 404 instead of redirecting to the editor. It happens on all our Ghost apps, on two different Cloudron servers. Standard Ghost installs and Ghost(Pro) on the same version work fine (Ghost forum thread: https://forum.ghost.org/t/edit-is-not-redirecting-toward-backoffice-anymore/63947).

    Root cause, as far as I can tell from the sources:

    1. start.sh rewrites the config on every boot with:

      json -I -f /app/data/config.production.json -e "this.admin = '${CLOUDRON_APP_ORIGIN}'"
      

      so admin is a string. Ghost expects an object: "admin": { "url": "..." }. Its defaults.json ships "admin": { "redirects": true, "sessionMaxAgeMs": 15552000000 }.

    2. Ghost only redirects /edit to the admin when config.get('admin:redirects') is truthy. Otherwise the entry controller calls next() and you get a 404 (core/frontend/services/routing/controllers/entry.ts).

    3. Up to 6.67 this was harmless: nconf looked up admin:redirects store by store and fell back to defaults.json. Since 6.68, Ghost builds one merged, frozen config tree (createConfig(nconf.get()) in core/shared/config/loader.ts). In that merge the string replaces the whole default admin object, so admin:redirects (and probably admin:sessionMaxAgeMs) end up undefined.

    Editing config.production.json by hand doesn't help, because start.sh overwrites it on the next restart.

    Suggested fix: write admin as an object, and convert the old string format for existing installs, e.g.

    json -I -f /app/data/config.production.json \
        -e "this.admin = { url: '${CLOUDRON_APP_ORIGIN}' }"
    

    The "url follows admin" check above it (line ~27) would then need to compare admin.url, or the string value forinstalls not yet migrated, against url.

    Possible workaround in the meantime (not tested yet): env vars take priority over the config file in Ghost's nconf setup, so this should restore the default:

    cloudron env set --app <app> admin__redirects=true admin__sessionMaxAgeMs=15552000000
    

    Happy to test a package build if that helps.

    Thanks!

    London Web Agency : https://abstract27.com/

    1 Reply Last reply
    1
    • J joseph moved this topic from Support on
    • jamesJ
      jamesJ
      james
      Staff
      wrote on last edited by
      #2

      Hello @jrl-abstract27
      Thanks for reporting. I will look into it.

      1 Reply Last reply
      1
      • jamesJ
        jamesJ
        james
        Staff
        wrote on last edited by
        #3

        Hello @jrl-abstract27
        The update https://forum.cloudron.io/post/130902 should have resolved this issue.
        Marking the topic as solved for now, but please give feedback if you can confirm the fix as well.

        1 Reply Last reply
        1
        • jamesJ james has marked this topic as solved on

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Bookmarks
        • Search