Cloudflare Tunnel with Nginx

I can’t seem to get this setup right. When I have the the url set as local I can access everything fine, the previews for the site work great and portal works.
When I flip it to https of my domain, everything is broken nothing works.
Switching it to http fixes it so the page loads but my admin stuff won’t load previews and the portals are also broken as well.

You’ll have to provide more details, like the exact URLs and errors when it doesn’t work, your Ghost and Nginx config files and relevant errors from your log files.

So the site is
I initially thought it was the tunnel causing the issue but now I am guessing it is nginx.
I am not a master at nginx so I am using nginxpm, I just turned websocket support on but still appears to not be working correctly.
EDIT: Appears my original theory was incorrect. I have set tunnel to point directly at the container and it still seems to be giving me the same issue.

Found something else. Brave is complaining about mixed content and that members api is being served through http so it’s being blocked. I assume this is the issue? How do I fix this?

So you’re using Docker for Ghost and database? Please share details of you OS and setup.

Likewise, please share your Nginx configuration. Is this a Docker container, too?

Finally, what are the SSL settings in Cloudflare, and how have you set up origin certificates?

The mixed warning is likely caused by an incorrect entry in config.production.json, i.e., you specified http instead of https for the site. For Docker, you need to pass an environment variable.

2 Likes

I don’t have configs right now but can get them when I’m home.
But for the configurations when I put HTTPS instead of http it breaks the website and doesn’t load anything, i assume this has something to do with how the tunnel serves the website.

I’m uncertain what you mean by tunnel; Ghost should sit behind an Nginx proxy using http and a unique port. Nginx should serve pages using https, i.e., port 443. The Ghost config should state the relevant https URL for your site.

Finally, Cloudflare sits in front of your server, and typically authenticates using certificates provided by you or created using the Cloudflare interface.

I suggest you pit Cloudflare into development mode until you have tour site running correctly.

1 Like

I’ll have to see if that’s an option for CloudFlare tunnels. Thanks.

More detail upfront would have been useful. It looks like the Cloudflare daemon looks for localhost:8080, so you could set Nginx to proxy Ghost and listen only on 127.0.0.1:8080. You’ll still need to set the Ghost environment variable for the public domain, so internal links are constructed correctly.

Alright. I set it to https and it seems to have cleared that issue but now getting CORS error and still not able to click sign in or subscribe.
I am not reverse proxying right now cause I want to make sure it’s working with out it first then I can play with that next.

EDIT: It’s working. Now I’ll have to play with reverse proxy and see if I can get that to work. Thanks!