r/CloudFlare: How to I get cloudflare tunnel to accept localhost/nextcloud as a service URL?

💡
This article archives a conversation, which took place in a subreddit post (original source linked below) and to which I contributed a solution or answer (with the u/MasterofSynapse handle), in a Q&A format.

Original Reddit post: https://www.reddit.com/r/CloudFlare/comments/wy9skk/how_to_i_get_cloudflare_tunnel_to_accept/

Question

I have nextcloud installed on my raspberry pi and the web server runs on localhost/nextcloud but cloudflare says that the service URL is not valid when setting up a tunnel. I can't access nextcloud with localhost:80. How would I configure the tunnel?

Answer

Nextcloud is running in a subfolder within the webserver on port 80.

So essentially, you configure the Service section to be http://localhost to point to the webserver and the Public Hostname to

Subdomain: example1

.

Domain: example.com

/

Path: empty


Then you can just open http://example1.example.com/nextcloud in your browser and you get your Nextcloud instance.

Comment 1 on Answer

Thank you so much! This worked perfectly

My response to comment 1

Good to hear.

Just remember for the future that the Service section can only handle DNS names, IP addresses and ports, not any subfolders of an application.

Only the Cloudflare Access applications can do that.