[TUNNELS] Working but content is not there

Hi! I'm trying to setup a homelab network with cloudflare tunnels, I made them work in the past in VPS like ec2 and in my personal computer as well but now running inside a raspberry pi zero 2 w i'm having issues, the tunnel is healthy, but content on my site won't load. I'll leave some pictures with configurations and anything that can be useful. Doing a curl inside the raspberry works fine the site is there. Just in case i'm trying to serve a static folder with http-server inside docker
No description
No description
8 Replies
jd
jdOP13mo ago
Dockerfile is something like this
FROM node:20.9.0-alpine3.18

WORKDIR /app

RUN npm install -g http-server

COPY ./data ./data

EXPOSE 8080

CMD ["http-server", "./data", "-p", "8080"]
FROM node:20.9.0-alpine3.18

WORKDIR /app

RUN npm install -g http-server

COPY ./data ./data

EXPOSE 8080

CMD ["http-server", "./data", "-p", "8080"]
removing the path /portfolio solved the issue.. but why? I need to understand that since I want to use everything homelab related in the subdomain homelab then in the / after put the apps i'm going to expose
Chaika
Chaika13mo ago
Matching on /portfilo is just saying "only send /portfilo requests to this server", the origin will still receive the path as /portfilo, if it's not handling requests to that path, it won't work. If you try locally curling it to /portfilo, does it work? imo just use separate subdomains, using path for different services is generally weird and can cause issues/not all apps can work with it, etc. Things are mostly built around the idea of a unique subdomain/hostname for each service as well. If you ever move the service to a different server, it's easier to migrate specific things, etc Free can have 1k dns records per website/zone, there's no real reason not to use separate subdomains
jd
jdOP13mo ago
Yeah I get the point, I was just trying to keep things under homelab subdomain till I'll migrate things over the raspberry since rn everything Is running fine but in a EC2 and I have all my aplications there with a tunnel already How can I use then if I want subdomains like -> homelab.nginx.<domain> homelab.portfolio.<domain> ?
Chaika
Chaika13mo ago
that's too deep for Cloudflare's default ssl (Universal certs are just wildcard *.domain.com, domain.com, and wildcards with ssl certs only work for the first label .). You could do homelab-nginx.domain and homelab-portfilo.domain If you're using zero trust dashboard managed tunnels, you'd just add those as new Public Hostnames pointing at specific services, and it'd take care of the dns
jd
jdOP13mo ago
Okie! I'll stick with that for now, is there an article or guide somewhere for if in the future I want to use the path thing and have everything under one subdomain? I would like to do that even if is weird
Chaika
Chaika13mo ago
There's quite a few guides about using Zero Trust tunnels, but none specifically about using paths like that as far as I know. It's also a bit more of a generic app question, as some apps simply will not work unless they support running like that, under a specific paths. They need to change how they reference their resources and such. If they assume and link their resources relatively like /index.css, it just won't work. But yea, it's just overall a bad idea due to it being inflexible from a dns statepoint (can only be pointed at a specific set of servers, unlike subdomains which can point at different ones, CF and Tunnels muddle this a bit), Cookie security and other browser security mechancisms, etc
jd
jdOP13mo ago
In my head I would be cooler to have everything in one place and then just change the / but it seems a terrible idea as you mention hahaha its okay I'll be a normal person and use subdomains MeowHeartCloudflare thanks for taking you time to explain!
Chaika
Chaika13mo ago
it's not universally a bad idea, some companies do something like static html on website root, and login/control panel/etc under a subpath like /dashboard/, or mounting /api/ like the CF Dash does which can also help with cors/security stuff (although you can deal with cors mechanisms via the headers & other ways), but those are more limited cases, and generally limited to a few apps/servers with the same purpose, and usually custom made for that, and can still involve a bit of arm twisting to get things to play nice
Want results from more Discord servers?
Add your server