Hey Brandon,
You will want to listen on 0.0.0.0 instead of localhost.
This didn’t change anything. I tried all the below.
I can see in the logs that caddy is getting the request with both localhost and 0.0.0.0. The issue is that the response from caddy isn’t returning the basic auth headers (or any content at all). The caddy logs show that http auth header is not being returned.
This works locally perfect, so it seems something here on render is confusing caddy.
http://localhost:{$PORT}
log
reverse_proxy 0.0.0.0:5555
basicauth {
{$STUDIO_USERNAME} {$STUDIO_PASSWORD_HASH}
}
http://0.0.0.0:{$PORT}
log
reverse_proxy localhost:5555
basicauth {
{$STUDIO_USERNAME} {$STUDIO_PASSWORD_HASH}
}
http://0.0.0.0:{$PORT}
log
reverse_proxy 0.0.0.0:5555
basicauth {
{$STUDIO_USERNAME} {$STUDIO_PASSWORD_HASH}
}
Are you using the same version of Node locally and on Render?
Yes, I have 12.18
in .node-version
I got it working! Had to explicitly specify the domains
Caddyfile
{
debug
admin off
}
http://${RENDER_EXTERNAL_HOSTNAME},
http://mydomain.com {
reverse_proxy 0.0.0.0:5555
log
basicauth {
{$STUDIO_USERNAME} {$STUDIO_PASSWORD_HASH}
}
}
Why is it not possible to run two services on different ports in the same render.com service? (eg. the webapp on 443 and prisma studio on port 5555) @flybayer’s config worked for me except that I couldn’t access ${RENDER_EXTERNAL_HOSTNAME}
in my Caddyfile. So hardcoded the hostname like this:
http://mysite-prisma-studio.onrender.com {
reverse_proxy 0.0.0.0:5555
log
basicauth {
{$STUDIO_USERNAME} {$STUDIO_PASSWORD_HASH}
}
}
Now prisma studio is available via https://mysite-prisma-studio.onrender.com
and my normal website via https://mysite.com
.
Hi @tom, it is possible to run multiple services on different ports in the same Render service, but only one can be made available to the public internet. The rest will be available internally within the private network Render automatically creates for your services and databases. You can always create a proxy that forwards traffic on to multiple backing services. If you have multiple open ports you can specify which one should receive incoming traffic by setting a PORT
environment variable.
Regarding your Caddyfile, I’m guessing you need to mimic @flybayer’s example more closely with:
http://mysite-prisma-studio.onrender.com, http://mysite.com {
reverse_proxy 0.0.0.0:5555
log
basicauth {
{$STUDIO_USERNAME} {$STUDIO_PASSWORD_HASH}
}
}