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

    frankjonen

    04/28/2023, 1:22 AM
    OK.
  • f

    frankjonen

    04/28/2023, 1:39 AM
    Is there something in that documentation page that's missing and essential? I don't get why it's not working despite me following the displayed instructions to a tee.
  • The plugin documentation
    c

    Chaika

    04/28/2023, 1:42 AM
    The plugin documentation? You're using normal git integration, added the html contact form as is (needs the
    data-static-form-name
    attribute to be set to anything), you have the functions folder in your root (not in your output directory) with the _middleware.ts file, you can see in build logs under the functions tab, the middleware listed under route configuration?
    f
    • 2
    • 22
  • z

    zizi

    04/28/2023, 1:14 PM
    I can use socket tcp connect now? https://community.cloudflare.com/t/2023-4-28-workers-runtime-release-notes/502941
  • k

    kian

    04/28/2023, 1:16 PM
    Not yet.
  • z

    zizi

    04/28/2023, 1:17 PM
    seems close to use in prod?
  • h

    HardAtWork

    04/28/2023, 1:17 PM
    Maybe, maybe not
  • e

    Epailes

    04/28/2023, 2:53 PM
    Not sure what channel is best to share this, but Stripe v12 now supports cloudflare workers without all the faff that was needed before:

    https://www.youtube.com/watch?v=Tr4ORJZ8DFg▾

  • j

    James

    04/28/2023, 2:57 PM
    Yeee this landed in v11.10.0, it's very nice!
  • h

    hjpotter92

    04/28/2023, 5:32 PM
    is there a way to get certificate chain for the
    workers.dev
    ? i'm deploying a worker which would be called from a minimal https client; and it needs the CA certs to validate TLS/SSL connection
  • h

    hjpotter92

    04/28/2023, 5:32 PM
    i tried using the origin CA cert: https://developers.cloudflare.com/ssl/origin-configuration/origin-ca#cloudflare-origin-ca-root-certificate but i get the following error instead: x509: certificate signed by unknown authority
  • h

    HardAtWork

    04/28/2023, 5:43 PM
    Here is a list of CAs that Cloudflare uses: https://developers.cloudflare.com/ssl/reference/certificate-authorities/
  • h

    hjpotter92

    04/28/2023, 6:27 PM
    thanks 🙂 i used
    openssl
    to get the chain instead:
    Copy code
    sh
    openssl s_client -showcerts -verify 5 -connect <domain>:443
  • w

    Wichard

    04/28/2023, 7:13 PM
    I am making an HTTP request from my Rust worker and I want to time how long it is taking in milliseconds. Is this possible to do?
  • w

    Wichard

    04/28/2023, 7:17 PM
    I tried std::time::Instant but it errors out: 'time is not implemented on this platform'
  • b

    btc10mm

    04/28/2023, 8:06 PM
    how would I go about debugging a worker route that is only matching and firing the worker occassionally. for example:
    example.com/*
    is firing for
    example.com/cart.js
    but not
    example.com/
    or
    example.com/?debug
    or
    example.com/products/foo
    . I can see the cart.js come across both streaming worker logs as well as instant logs, but not the other requests
  • k

    kian

    04/28/2023, 8:48 PM
    https://docs.rs/worker/0.0.16/worker/struct.Date.html
  • k

    kian

    04/28/2023, 8:48 PM
    Timing in Workers has Spectre mitigations so it won't be an accurate timer
  • w

    Wichard

    04/29/2023, 8:42 PM
    Hi, how can I make a POST request from workers-rs? It seems like Request::new() only accepts url and method as parameters, not sure how to include the payload
  • k

    kian

    04/29/2023, 8:42 PM
    new_with_init
  • k

    kian

    04/29/2023, 8:42 PM
    https://docs.rs/worker/0.0.16/worker/struct.RequestInit.html
  • w

    Wichard

    04/29/2023, 8:43 PM
    Ah, thanks, I'll have a look at that!
  • k

    kian

    04/29/2023, 8:43 PM
    > Currently requires a manual conversion from your data into a wasm_bindgen::JsValue.
  • k

    kian

    04/29/2023, 8:43 PM
    Keep note of this
  • k

    kian

    04/29/2023, 8:44 PM
    i.e if you want to send a JSON body
    Copy code
    rs
    JsValue::from(
        serde_json::to_string(&payload)?
    );
  • o

    olieollyollie

    04/29/2023, 10:08 PM
    hey guys, anyone know how to resolve
    TLS peer's certificate is not trusted; reason = unable to get local issuer certificate
    ? i'm running
    wrangler dev --experimental-local --experimental-local-remote-kv --persist
    and trying to put values in a KV namespace. strangely enough, the request does actually reach the KV storage and the value is stored, it just throws this error after each put. my platform is windows 10.
  • s

    Serby

    04/30/2023, 3:20 AM
    hello, im trying to figure out if the workers can handle subdomains, similar to subdirectories ... Ive made workers for redirecting subdirectories to sub.domains , while maintaining the orgin path on the clients end... but im trying to wildcard all the sub.domains like
    *
    .domain. com and then use the request or Orgin header to either regex and strip to capture the "sub". part to perfom a query / redirect if the query turns up null for example is this possible with the workers, the only thing ive found for subdomains are like the CAA records but thats not what I need since i need `*`wild cards
  • s

    Serby

    04/30/2023, 3:27 AM
    like ive done something like this with subdirectories i just simplified it here ..
    Copy code
    /*masted redirect*/
    const DESTINATION = ‘sub.domain.com’;
    
    const ORIGINS = {
    ‘/some-sub-directory: ‘/some-sub-dirctory’,
    
    };
    
    
    addEventListener(“fetch”, event => {
    let requestURI = new URL(event.request.url);
    
    if (requestURI.pathname in ORIGINS) {
    event.respondWith(rewriteURL(event.request));
    }
    
    })
    
    async function rewriteURL(request) {
    var URI = new URL(request.url);
    
    URI.protocol = “https”;
    URI.hostname = DESTINATION;
    return fetch(URI, request);
    }
  • c

    Chaika

    04/30/2023, 3:27 AM
    If your question is if you can use workers with wildcard subdomain, the answer is yes with a few limitations: To get it working, you just create a originless record
    AAAA * 100:: Proxied
    Then in a Worker Route, you can make a route
    *.example.com/*
    (or you can just use
    */*
    to match everything). This only works with Worker Routes though, not custom domains, and for each subdomain you want to use normally, you'll need to add a worker route with none (ex.
    usefulsubdomain.example.com/*
    Service:
    None
    ) This also is only going to work with first level subdomains on free, as the SSL cert you have won't cover any deeper subdomains
  • s

    Serby

    04/30/2023, 3:35 AM
    what do you mean by not custom domains ? like I have a domain name I pointed to the account, I wont be able to use that ? the whole site is more of a webapp that is just dishing out the HTML and the html as its more of a standalone app that doesnt need to make any requests back to the server it just makes outgoing requests to other services outside of my server, so the only thing Its going to do is grab
    *
    "sub". mydomain .com and the response is going to just be my html template + injecting the `*`"sub" domain and returning it to the client as "whateverTheyEntered".mydomain.com
1...242524262427...2509Latest