https://discord.cloudflare.com logo
Join Discord
Powered by
# functions
  • r

    Rui Saraiva

    03/17/2022, 5:20 PM
    Sorry, GA stands for?
  • w

    Walshy | Pages

    03/17/2022, 5:21 PM
    Ah sorry General Availability basically a stamp of stable / production ready
  • r

    Rui Saraiva

    03/17/2022, 5:22 PM
    Ah makes sense 👍
  • d

    Deleted User

    03/18/2022, 2:32 AM
    Hai Guys, may I ask about how can launch the cloudflare cdn with Amazon? Due to my nameservers are connecting Amazon and the site is live now
  • t

    the-philociraptor

    03/18/2022, 2:58 AM
    Hitting a weird error trying to use functions. Specifically I have a catchall at
    /functions/api/[[path]].js
    . In this catchall, I am just doing a resolveOveride to recreate similar functionality to the page rules functionality.
    Copy code
    export async function onRequest(context) {
      // Contents of context object
      const {
        request, // same as existing Worker API
        env, // same as existing Worker API
        params, // if filename includes [id] or [[path]]
        waitUntil, // same as ctx.waitUntil in existing Worker API
        next, // used for middleware or to fetch assets
        data, // arbitrary space for passing data between middlewares
      } = context;
    
      let config = {};
      config.cf = {resolveOverride: "api.mydomain.com"};
      return fetch(request, config);
    }
    Copy code
    api.mydomain.com
    exists and it pointing to my api endpoint. I followed the instructions in the page rule doc and enabled the CDN on the record: https://canary.discord.com/channels/595317990191398933/910978223968518144/954020154226933801 When deploying to pages and hitting a valid path on the API, I get this error:
    Copy code
    Error 1000 Ray ID: 6edaa8a262ae1877 • 2022-03-18 02:50:04 UTC
    DNS points to prohibited IP
    What happened?
    You've requested a page on a website (dev.mydomain.com) that is on the Cloudflare network. Unfortunately, it is resolving to an IP address that is creating a conflict within Cloudflare's system.
    
    What can I do?
    If you are the owner of this website:
    you should login to Cloudflare and change the DNS A records for dev.mydomain.com to resolve to a different IP address.
    Anyone got any ideas what is going on?
  • k

    kian

    03/18/2022, 10:01 AM
    What are you pointing the
    dev.
    DNS record to?
  • s

    simpson

    03/18/2022, 11:32 AM
    has anyone used functions to ssr a nextjs page? Bonus points if you have sample code 🙂
  • s

    simpson

    03/18/2022, 11:39 AM
    (is it even possible?)
  • s

    simpson

    03/18/2022, 11:48 AM
    I need to serve profile pages (website.com/user/david). I can statically generate them and setup a cron to frequently rebuild but that feels like an antiquated solution but does give you the caching goodness (we have over 32k+ builds on AWS Amplify). I'd like to see if there is a way to build a function (/functions/user/username.js) that takes in username passed from the browser and SSR render the page so we still get the SEO
  • j

    Jacob | Pages

    03/18/2022, 11:55 AM
    I haven't done it but I feel like that's possible
  • l

    lmtr0

    03/18/2022, 12:13 PM
    Hmm, I am not sure what you mean. If your site is marked as routed, the cdn is already working
  • l

    lmtr0

    03/18/2022, 12:15 PM
    you can also spin up a proxy that helps you cache static assets
  • l

    lmtr0

    03/18/2022, 12:16 PM
    like my proxy https://github.com/lmtr0/ximgproxy
  • l

    lmtr0

    03/18/2022, 12:16 PM
    It's called a x**img**proxy but i caches everything you ask from it
  • l

    lmtr0

    03/18/2022, 12:28 PM
    If you are interested in using the worker proxy and want help setting it up, please move the chat over to #779390076219686943 or dm me :)
  • t

    the-philociraptor

    03/18/2022, 12:32 PM
    It's pointed to an ALB at AWS. I have valid certificates and routing rules for both
    dev.
    and
    api.
    there.
  • k

    kian

    03/18/2022, 12:33 PM
    Do you have the IP to hand?
  • k

    kian

    03/18/2022, 12:34 PM
    The error you're getting is that
    dev.
    is pointing to an IP that conflicts with Cloudflare's network
  • k

    kian

    03/18/2022, 12:34 PM
    That usually means it points to a Cloudflare IP though
  • i

    Isaac McFadyen | YYZ01

    03/18/2022, 12:34 PM
    ^ It used to be that people would point a DNS record to
    1.1.1.1
    to discard any requests, but that's changed now.
  • i

    Isaac McFadyen | YYZ01

    03/18/2022, 12:35 PM
    Now it's an AAAA record of
    100::
  • t

    the-philociraptor

    03/18/2022, 12:39 PM
    Well, dev. would point to an ip that conflicts because that is the pages IP. 😄
  • t

    the-philociraptor

    03/18/2022, 12:39 PM
    api. is pointing to the alb though, CNAME record, typical AWS domain name
  • k

    kian

    03/18/2022, 12:40 PM
    You wouldn't point to Cloudflare's IP ranges, you point it to a discard address (like the
    100::
    that Isaac mentioned) and let Cloudflare handle it from there
  • k

    kian

    03/18/2022, 12:40 PM
    Or I think for Pages specifically, just
    CNAME
    it
  • k

    kian

    03/18/2022, 12:40 PM
    i.e
    dev.foo.bar
    to
    foo.pages.dev
  • t

    the-philociraptor

    03/18/2022, 12:40 PM
    Pages set up the record for itself when I put in the CNAME
  • t

    the-philociraptor

    03/18/2022, 12:40 PM
    I didn't touch it
  • t

    the-philociraptor

    03/18/2022, 12:41 PM
    pages works fine. That error shows when it's doing the /api logic
  • t

    the-philociraptor

    03/18/2022, 12:46 PM
    FWIW, switching the hostname in the request seems to work a little better - although it's discarding something in the request. I've yet to identify what. It prevents my login callback from working though
1...101102103...392Latest