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

    sathoro

    05/24/2023, 3:15 PM
    yeah go for it
  • b

    BenParr

    05/24/2023, 3:22 PM
    anyone any ideas above on whats wrong with how im setting my secrets?
  • c

    Cyb3r-Jok3

    05/24/2023, 3:38 PM
    I mean no heavy compute or long requests
  • s

    sathoro

    05/24/2023, 3:39 PM
    we do several minute long requests it works fine actually
  • s

    sathoro

    05/24/2023, 3:39 PM
    the client just needs to stay connected lol
  • s

    sathoro

    05/24/2023, 3:40 PM
    using SSE
  • k

    Kartik

    05/24/2023, 3:41 PM
    i have an api endpoint api/v1/hello on a different server, and i am using worker as a proxy server, but i am not able to pass the required headers to the sub request in the worker fetch request
  • k

    Kartik

    05/24/2023, 3:42 PM
    from client side, when i pass the headers its working but its not being forwarded to the request server
  • k

    kian

    05/24/2023, 3:42 PM
    What's your Worker code?
  • k

    Kartik

    05/24/2023, 3:45 PM
    Copy code
    app.get("*", async (ctx) => {
      const cacheurl = new URL(ctx.req.url);
      // console.log(cacheurl);
      console.log(ctx.req.headers.get("pix-api"));
      let headers = new Headers();
      headers.set("pix-api", "api-key");
      cacheurl.host = "example.com";
      const result = await fetch(cacheurl, {
        headers,
      });
    
      // response = new Response(result.body);
      // ctx.executionCtx.waitUntil(cache.put(cacheKey, response.clone()));
      return new Response(result.body, {
        headers: {
          ...headers,
          "res-pix-api": result.headers.get("pix-api") || "Not Found",
        },
      });
  • k

    Kartik

    05/24/2023, 3:46 PM
    using hono js
  • d

    dave

    05/24/2023, 3:48 PM
    all of our public facing API services are on Cloudflare Workers, and even most of the private APIs are also on Workers.
  • k

    kian

    05/24/2023, 3:49 PM
    headers
    is always going to be blank other than
    pix-api
    in that scenario.
  • b

    BenParr

    05/24/2023, 3:50 PM
    cloudflare fetch is adding bom to the data, how can i stop this?
  • k

    kian

    05/24/2023, 3:50 PM
    You're not using the request headers, you define
    headers
    with
    let headers = new Headers();
    which is an empty object and then only contains the
    pix-api
    header which you set.
  • k

    kian

    05/24/2023, 3:50 PM
    If you want to use the request headers, that'd be
    ctx.req.headers
  • k

    Kartik

    05/24/2023, 3:50 PM
    looks like this headers is also not getting there
  • k

    Kartik

    05/24/2023, 4:00 PM
    got it
  • k

    Kartik

    05/24/2023, 4:00 PM
    typo
  • k

    Kartik

    05/24/2023, 4:00 PM
  • u

    𝓣𝓸𝓫𝓲

    05/24/2023, 4:07 PM
    hi πŸ˜„ with the upcoming workers snippets, in theory i should be able to make a "free" load balancer for an api; and the only real limit should be the dns resolution fees, is that correct (which only start at 1m/month)?
  • k

    kian

    05/24/2023, 4:11 PM
    Snippets can only make 1 subrequest so you wouldn't be able to do that.
  • k

    kian

    05/24/2023, 4:11 PM
    Well, you can do Math.random and select a subdomain based on that
  • k

    kian

    05/24/2023, 4:11 PM
    but you wouldn't be able to hit one and then decide to fallback if it failed
  • n

    Neiki

    05/24/2023, 4:44 PM
    can i somehow send me an email or sending with an webhook if that happens again? like let me notify

    https://cdn.discordapp.com/attachments/779390076219686943/1110971634870923367/image.pngβ–Ύ

  • l

    Licoricevntrs

    05/24/2023, 4:48 PM
    is there a place where we can see how much deployments we already made?
  • n

    Neiki

    05/24/2023, 4:56 PM
    i cant find anything to workers or crons in the notifications tab, only about pages
  • u

    𝓣𝓸𝓫𝓲

    05/24/2023, 5:04 PM
    yeah, fallback would not be a possibility. but i could do either random, or based on some "hash" of the request ip + maybe some user cookie or sth.
  • l

    lastguru

    05/24/2023, 5:04 PM
    Hi, given that workers are now able to connect to an arbitrary TCP port, is regular fetch from non-http ports (like 8080) now allowed?
  • u

    𝓣𝓸𝓫𝓲

    05/24/2023, 5:07 PM
    @kian then, if 1 request can be split to multiple subdomains, one could assign only functioning servers to those subdomains, i.e. if i know one of my servers is down, i change its subdomain to point to a known good server
1...249024912492...2509Latest