Setup a Reverse Proxy with Ghost & Leadpages

Hello!

I’m self-hosting a Ghost blog and would like to run it on a subdirectory from my main domain that is on Leadpages.

Looking at Digital Ocean, I found “Caddy”, but I’m totally new and not used to this.

I need help understanding how to write the Caddyfile, and how to run or activate it.

Also, I have specific URLs today: all my blog articles are parameters.

Meaning I am transitioning from: abc.com/blog/?p=article_1 to abc.com/blog/article_1/.

Do you think it’s possible to setup this inside the Caddyfile? If so, how?

So, far, I have:

abc.com {
        redir /blog /blog/
        reverse_proxy abc.com/blog/* http://ghost_server_ip:2368

        reverse_proxy abc.com/blog/?p=* http://ghost_server_ip:2368

        reverse_proxy / myleadpagesip
        reverse_proxy /* myleadpagesip/{uri}
}

Also: How do I test it without doing the changes in my Cloudflare yet?

Thank you so much to anyone who helps,
Jeremy

Please fill out the help topic template, as per the forum rules.

You might have missed it if you tried to open a topic while looking at the wrong forum category. Click on New Topic, choose the Help category, then copy and paste the template as a reply into this topic, and fill it out.

That said, you’re probably looking for the rewrite directive:

Please also read about how request matching works:

2 Likes

Will take a look and upload my question in this category if needed, thanks.

Posted with the right form here: Writing a CaddyFile for Reverse Proxy