deploy_feedback icon indicating copy to clipboard operation
deploy_feedback copied to clipboard

Add / Assign custom domains to functions programatically

Open cstrnt opened this issue 2 years ago • 4 comments

What problem are you trying to solve?

I want to build a CDN on top of deno deploy. This requires my customers to have it running on their domain so that they can send the cookies along safely. I would need to add every single domain by hand which doesn't scale!

Describe the solution you'd like

Some simple API which allows me to add and assign a custom domain to my deno deploy function.

Describe alternatives you've considered

I could potentially just reverse engineer this how it's currently done but it's probably error-prone since the API could always change. Also tokens might be an issue

Documentation, Adoption, Migration Strategy

No response

cstrnt avatar Jul 09 '23 12:07 cstrnt

Is it possible to get some input from a Deno Deploy team member on this? A similar request also exists at https://github.com/denoland/deploy_feedback/issues/321

Supporting this would open up Deno Deploy to a whole new audience / use case for users running SaaS, myself included.

The solution would be to support the addition of custom domains programmatically via a Deno Deploy REST API and allow for more than 100 domains (perhaps charging per domain over 100 like Cloudflare and fly.io do).

Thanks!

rossholdway avatar Oct 17 '23 19:10 rossholdway

We're very actively working on this, with the use cases such as building their own services on top of Deno Deploy in mind. We hope that we will announce something exciting next month, please stay tuned :)

magurotuna avatar Oct 18 '23 02:10 magurotuna

While I was waiting for some action here I did some reverse engineering :D

Here are the three most important API calls I've found

Add a domain to your Project POST https://dash.deno.com/_api/projects/{projectName}/domains -> JSON Body: { "domain": "<your domain name>" }

Verify an added domain POST https://dash.deno.com/_api/projects/{projectName}/domains/{domainName}/verify

Remove a domain from your Project DELETE https://dash.deno.com/_api/projects/{projectName}/domains/{domainName}

Make sure to send the token cookie along. The value of the cookie is a deno deploy access key which you can get here: https://dash.deno.com/account#access-tokens

cstrnt avatar Oct 20 '23 07:10 cstrnt

I think this can be closed now with the addition of the new deploy REST API 🎉

https://apidocs.deno.com

rossholdway avatar Nov 19 '23 10:11 rossholdway