Accessing site through Cloudflare tunnel

I have installed the bench and set up a site on a home server. I can access the site without problems LAN. But, I want to access it from outside. The only way is through cloudflare tunnel because I can’t port forward with the current ISP. I have other services on home server that have no problem with the tunnel. I just point a subdomain to something like http://localhost:8066 and it works flawlessly. But with frappe, it doesn’t serve static files.

Now, here is what I did:

  1. Tried accessing frappe from the local network on http://localip:8000. Works fine.
  2. Point to HTTP localhost:8000 in zero trust console. Like I did with any other service.
  3. When I go to it doesn’t render CSS or any other static files
  4. I open the console and it shows a 404 error on static files. Can’t access them.

I saw that there is already a post related to Cloudflare tunnel. And that @iMoshi has made it work, But couldnt figure out what they did. Could you provide some info on how you made i work for you. I am sure it will also be useful for future self-hosted tinkerers.


Just add the domain to ERPNext site with following command:

bench setup add-domain

You will need to regenerate the nginx configuration by runnning bench setup nginx and reload the nginx service by running sudo service nginx reload to put your custom domain in effect

1 Like

That worked perfectly.

Thanks, I could kiss you now. I banged my head on random articles on why static files are not served, lol.

One note for future readers, it has to be bench setup nginx. Running bench setup production $USER doesn’t setup nginx properly.

Ha, nice. Yeah CF Zero trust is awesome, I’m starting to add more and more of my domains to CF :slight_smile:

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.