https://discord.cloudflare.com logo
Join Discord
Powered by
# workers-discussions
  • j

    James

    04/12/2023, 6:34 PM
    There are a few more technical differences as described on that page, but for most apps it won't matter.
  • r

    Ryder Cragie

    04/12/2023, 6:35 PM
    So basically, if you've already got a proxied record to a third-party website builder, and they provide the SSL certificate, use a Route rather than Custom Domain?
  • j

    James

    04/12/2023, 6:36 PM
    yeah I'd use a route there for sure. Custom Domains are great when you want the worker to be the origin essentially
  • r

    Ryder Cragie

    04/12/2023, 6:36 PM
    So there's no situation where you'd need to put the same domain in a Route AND Custom Domain?
  • p

    Ping for toast

    04/12/2023, 6:37 PM
    But isn't rust WASM still faster than v8? Just the startup?
  • j

    James

    04/12/2023, 6:37 PM
    You could... like let's say I had WorkerA set as a custom domain for
    example.com
    . But then I wanted a separate worker running on
    example.com/foo
    , that fetched from WorkerA, and then did some HTMLRewriting for example
  • p

    Ping for toast

    04/12/2023, 6:37 PM
    Why would I want to write a worker in rust if there is no performance benefit?
  • j

    James

    04/12/2023, 6:37 PM
    So yes, but we're talking very advanced and niche use-cases
  • r

    Ryder Cragie

    04/12/2023, 6:38 PM
    Thank you!
  • j

    James

    04/12/2023, 6:38 PM
    The Rust wasm is instantiated via V8 afaik. As for why you'd want to write it in Rust, there are use-cases wasm offers that JS doesn't performantly - image generation is a good example
  • j

    James

    04/12/2023, 6:38 PM
    Or maybe you just prefer Rust because the rest of your stack is in Rust
  • j

    James

    04/12/2023, 6:39 PM
    Those could be good example reasons
  • p

    Ping for toast

    04/12/2023, 6:39 PM
    But if I wanted to make a program that people deploy to workers (as their backend), I should probably just do it in javascript I guess?
  • p

    Ping for toast

    04/12/2023, 6:40 PM
    I'm considering making "pocketbase for workers" (unless someone has already done it?)
  • c

    Chaika

    04/12/2023, 6:40 PM
    The Certificate is a side benefit. It's an edge cert, like your universal. It doesn't effect the need for your origin to have a valid cert. Before Custom Domains, only Routes existed. You can still use a route and have your worker be the only origin (100:: record, and needs to be covered by a universal ssl or adv. cert). Custom Domains are just like a more "managed" option per say, with a few side benefits like taking care of the dns record, free adv. cert, and slightly different handling behind the scenes
  • j

    James

    04/12/2023, 6:41 PM
    If you want to make the developer experience the most approachable and easy for contributors, then yes I would recommend JavaScript (or ideally TypeScript).
    wrangler
    itself used to be Rust in v1, but switched to TypeScript for v2 for very similar "more contributors"-like (among other) reasons.
  • p

    Ping for toast

    04/12/2023, 6:42 PM
    I'm not necessarily interested in contributors, but I'd like to prevent bugs and make it fast. I guess rust is better at preventing bugs, js is better for speed?
  • j

    James

    04/12/2023, 6:43 PM
    That's a much larger conversation than I think we can boil down to simply "speed vs performance", haha. I'd go with whatever language you're most comfortable with honestly
  • r

    Ryder Cragie

    04/12/2023, 6:43 PM
    So for this should I use a Custom Domain or a Route? I will have nothing on the root domain other than this worker to do what I've described below. https://discord.com/channels/595317990191398933/909458221419356210/1095768962790330519
  • p

    Ping for toast

    04/12/2023, 6:44 PM
    Ok, so the performance hit is negligible I suppose. Benchmarks here would be wonderful though 😉
  • c

    Chaika

    04/12/2023, 6:45 PM
    Custom Domain, your use case doesn't need a route, and Custom Domains are easier. You can also delete the adv. cert it generates if you want, it doesn't provide any benefit as your Universal SSL already covers your apex. (It doesn't harm anything either though if you want to keep it, it will be preferred/used over your universal) (Talking about the code James made, if you're talking about that code you linked exactly, it looks like its meant to be over an existing origin, thus needing a route)
  • r

    Ryder Cragie

    04/12/2023, 6:45 PM
    And what about if I want to implement a logging tool like https://logflare.com or https://logtail.com ? They recommend a Route, but I guess it could depend on what's on the actual domain.
  • j

    James

    04/12/2023, 6:45 PM
    I wouldn't worry about whatever direction you choose. If you need to optimise in future, you can. I doubt you'll hit bottlenecks on either said any time soon
  • j

    James

    04/12/2023, 6:46 PM
    Really? I would absolutely recommend a Route over a Custom Domain for a proxy solution like this 🤔 The docs does too: > Unless that Worker acts exclusively as a proxy – meaning it will need to call fetch(request) on the incoming connection’s HTTP request to connect to an application server defined in DNS – the Custom Domain is the recommended solution.
  • r

    Ryder Cragie

    04/12/2023, 6:47 PM
    Wouldn't the Custom Domain add a Route essentially?
  • r

    Ryder Cragie

    04/12/2023, 6:47 PM
    Not visually and literally. I mean on the backend.
  • c

    Chaika

    04/12/2023, 6:47 PM
    For the code you made, that changes the host and fetches from a www subdomain? A Custom domain. If you're talking about the code he exactly linked/his earlier non-working solution then yea it would require a route to work
  • r

    Ryder Cragie

    04/12/2023, 6:48 PM
    ...
  • r

    Ryder Cragie

    04/12/2023, 6:48 PM
    I thought that's what it did.
  • r

    Ryder Cragie

    04/12/2023, 6:48 PM
    It already routes it. Right?
1...238723882389...2509Latest