I am using Raspberry Pi 4 with Dietpi OS. I got a few apps online with cloudflared tunnel. One of them is Nextcloud. While connecting to other applications via port on localhost (e.g. localhost:5112), I can connect to Nextcloud via localhost/nextcloud by default.
Is that possible to create a tunnel for localhost/nextcloud app to connect with nextcloud. domain. com subdomain?
Redirect would be the only option. It sounds like you’re going to end up with a directory mismatch, otherwise. Nextcloud’s URLs will all be referencing /nextcloud/, but you want it to all work in /.
Though if you’re willing to have it show up as nextcloud.example.com/nextcloud, that would be feasible. You’d still need the redirect for nextcloud.example.com/ to 301 to nextcloud.example.com/nextcloud/
You could configure your Nextcloud to run on the root and avoid all the redirection. I run my ownCloud at owncloud.example.com.
You will need to know how to configure the relevant virtual host in your webserver and adjust your Nextcloud configuration to match, both of which are outside the scope of Cloudflare Community discussion topics.