Custom domain for pull-request preview
S
Sharat M R
Basically staging.example.com is the primary domain and want feature-1.staging.example.com as pull requests preview where in feature-1 is the branch name.
Log In
R
Ricardo Villagrana
We need this, please!
P
Philippe Vezina
This would be great! Currently we use Render's API on PR previews to create our subdomains.
B
Bergur Hallgrimsson
Philippe Vezina: Can you elaborate how you achieve this?
P
Philippe Vezina
Bergur Hallgrimsson: We use a Ruby script to acheive this and make a few different custom domains. But generally speaking, if your requirements are quite simple, it could be done with this simple CURL request:
curl --location --request POST "https://api.render.com/v1/services/$RENDER_SERVICE_ID/custom-domains" \
--header "Authorization: Bearer $RENDER_API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "$RENDER_GIT_BRANCH.staging.example.com"
}'
Then if your DNS provider allows it, you can use their API to add the required DNS records programmatically.
m
mattis
Unfortunately this is a dealbreaker for us, we need the web platform on our domain in order for authentication to work, really hope this is implemented soon, until then we will have to use some other hosting solution.
T
Tobias Løfgren
Seconded, the
{branchName}.example.com
structure looks good to me.S
Sharat M R
One more simpler way to look at it is to allow option to assign domain per branch.
Y
Yashu Mittal
I would like to set a define custom name for sub-domain PR preview.
For example:
{app_name}-pr-{randomId}-{timestamp}.onrender.com
Š
Štefan Ľupták
This would be super useful.