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

    dave

    05/09/2023, 4:54 AM
    the only different thing we do for the frontend, is support using a refresh token. The JWT is encrypted as a JWE, to avoid the frontend team from getting curious and wanting to parse stuff they shouldn't parse lol.
  • e

    Erisa | Support Engineer

    05/09/2023, 9:09 AM
    Nice! This would be awesome to share in #783765338692386886 🙂
  • a

    AlHill

    05/09/2023, 9:12 AM
    I'm trying to make a worker which (among other things) receives a file and send it to R2. I'm making the call to the worker with a multipart/form-data body and I'm receiving it well in the worker, but the key which contains the file blob is not there. I don't know if I'm doing something wrong or it's a bug of any kind... I'm going a little crazy, anyone has a little help of me? T.T
  • j

    jøe

    05/09/2023, 10:30 AM
    Quick and easy question: I currently use const config = { domain: "example.com", } in a worker to define the domain. How do I define the domain to whatever domain the worker is working on?
  • n

    Nemesis Inkura

    05/09/2023, 10:30 AM
    I'm using the Typescript template here: https://github.com/cloudflare/workers-sdk/blob/main/templates/worker-typescript/src/index.test.ts When I use
    npm test
    none of my KV bindings, secrets, etc are available. They are however available when running using
    wrangler dev
    . What am I doing wrong?
  • k

    kian

    05/09/2023, 10:32 AM
    You could probably just read the request URL
  • k

    kian

    05/09/2023, 10:32 AM
    Copy code
    js
    export default {
      async fetch(req) {
        const url = new URL(req.url);
        const { hostname } = url;
      }
    }
  • s

    Sebastian Wißmüller

    05/09/2023, 10:33 AM
    Moved it there. Thank you! 🙂
  • j

    jøe

    05/09/2023, 10:35 AM
    Awesome, thank you!
  • j

    jøe

    05/09/2023, 10:42 AM
    I use the Welcome Bar app, but when I enable the worker route, it disappears. How to avoid?
  • d

    dave

    05/09/2023, 2:00 PM
    @sathoro it's even worse.. Supabase limits on CF-Connecting-IP. https://developers.cloudflare.com/fundamentals/get-started/reference/http-request-headers/#cf-connecting-ip-in-worker-subrequests

    https://cdn.discordapp.com/attachments/779390076219686943/1105494429961289819/image.pngâ–¾

  • s

    sathoro

    05/09/2023, 2:02 PM
    Supabase uses CF so it would be the Worker's IP address right?
  • k

    kian

    05/09/2023, 2:04 PM
    It'd be a shared IP that all Workers 'appear' as
  • k

    kian

    05/09/2023, 2:05 PM
    All cross-zone requests are
    2a06:98c0:3600::103
    , but that's not the 'real' IP that the request comes from - just what appears in
    CF-Connecting-IP
  • k

    kian

    05/09/2023, 2:05 PM
    so it'll be ratelimited, uh, very heavily
  • d

    dave

    05/09/2023, 2:06 PM
    yeah
  • d

    dave

    05/09/2023, 2:06 PM
    yeeeeeep, emailing them back now to explain it
  • d

    dave

    05/09/2023, 2:08 PM
    hmm, what would they need to change on their side to avoid the rate limiting? (I'm trying to give them as much of the solution as possible. 😛 )
  • k

    kian

    05/09/2023, 2:08 PM
    Ratelimiting Workers means going off the
    CF-Worker
    header, which is only present on requests from Workers.
  • k

    kian

    05/09/2023, 2:09 PM
    so they'd probably maintain
    CF-Connecting-IP
    generally but
    CF-Worker
    would take precedence
  • d

    dave

    05/09/2023, 2:12 PM
    shouldn't it be cf.worker.upstream_zone?
  • k

    kian

    05/09/2023, 2:13 PM
    If they have the Enterprise + add-on for doing it in Cloudflare, yeah.
  • k

    kian

    05/09/2023, 2:13 PM
    Otherwise, it's a normal request header they'll get on their origin.
  • k

    kian

    05/09/2023, 2:13 PM
    Depends if they're using CF for ratelimiting or not.
  • u

    Unsmart | Tech debt

    05/09/2023, 2:14 PM
    Even enterprise cant select worker upstream zone in the characteristics selector from what I see
  • k

    kian

    05/09/2023, 2:16 PM
    Works for me
  • k

    kian

    05/09/2023, 2:16 PM
    Well, with Edit Expression
  • k

    kian

    05/09/2023, 2:16 PM
    I have 0 out of 0 rules so I can't actually use it, it just doesn't throw an error
  • u

    Unsmart | Tech debt

    05/09/2023, 2:16 PM
    you cant edit expression for the characteristics
  • d

    dave

    05/09/2023, 2:17 PM
    > When configuring firewall rules, do not match on this header. Firewall rules are applied before Cloudflare adds the CF-Worker header. Instead, use the cf.worker.upstream_zone dynamic field, which contains the same value and exists for the same purpose. But this confuses me, I thought
    CF-Worker
    wasn't going to work for rate limiting?
1...244824492450...2509Latest