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

    Greg Brimble | Cloudflare Pages

    11/24/2021, 1:58 PM
    Does jekyll do any hashing or similar on local dev assets?
  • w

    wonkrattle

    11/24/2021, 1:58 PM
    No
  • w

    wonkrattle

    11/24/2021, 1:58 PM
    Not by default
  • w

    wonkrattle

    11/24/2021, 1:59 PM
    There are some plug-ins that will do that but unless you’re using one of those The names don’t change
  • w

    wonkrattle

    11/24/2021, 2:02 PM
    It has caused me some issues in the past
  • i

    Isaac McFadyen | YYZ01

    11/24/2021, 2:04 PM
    The SvelteKit adapter adds a hash to the end of each file (so any redeploys and changes don't cache). So I'm in favor of Cache-Control.
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:05 PM
    Gonna need to think about this a bit. I might put out a wrangler version which includes aggressive headers so people can try that out and let me know if it breaks things for them.
  • i

    Isaac McFadyen | YYZ01

    11/24/2021, 2:08 PM
    I'm looking at Redirects for changing
    /some-page
    to
    https://some-page.example.com
    . First, does that even work? The
    Proxying
    section of the docs says no, but is that because of the splat or the domain change?
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:09 PM
    Proxying ≠ redirects
  • i

    Isaac McFadyen | YYZ01

    11/24/2021, 2:09 PM
    Second, are redirects applied in front of a master
    _worker.js
    function, or will they be obscured by that?
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:09 PM
    So you can redirect, but not proxy.
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:09 PM
    Just dropping in a
    _redirects
    file:
    Copy code
    /some-page https://some-page.example.com
    should work just fine.
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:10 PM
    _worker.js happens first, then _headers and _redirects, and then the static assets.
  • i

    Isaac McFadyen | YYZ01

    11/24/2021, 2:11 PM
    Hmm... OK. I'm currently getting my functions 404 page instead of being redirected. Do I have to
    await next()
    ?
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:12 PM
    > my functions 404 page What is that?
    /functions/[[fallback]].js
    ?
  • i

    Isaac McFadyen | YYZ01

    11/24/2021, 2:13 PM
    Sorry, should have clarified. I'm using the SvelteKit adapter. So the way it works is that it it builds a map of the static assets at build-time, then matches any requests to that and if any match it sends it to the static file.
  • i

    Isaac McFadyen | YYZ01

    11/24/2021, 2:13 PM
    That might be why it's not working, since it's not technically a static file.
  • i

    Isaac McFadyen | YYZ01

    11/24/2021, 2:14 PM
    I have alternatives if the _redirects won't work. Just thought I'd give it a shot.
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:14 PM
    Ah yeah, that makes sense.
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:16 PM
    The SvelteKit adapter could, instead of first checking its own manifest, try to see if it can get something from
    env.ASSETS.fetch
    https://github.com/sveltejs/kit/blob/master/packages/adapter-cloudflare/files/worker.js#L10-L12
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:17 PM
    If (!response.ok) do svelte things. Else serve the response
  • i

    Isaac McFadyen | YYZ01

    11/24/2021, 2:19 PM
    Good idea. I'll try adding that to my local copy (I'm using an out-of-tree version so I can customize caching) and if it works well I could submit a PR?
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:19 PM
    @User authored the extension, so he might have thoughts.
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:19 PM
    I've never done Svelte stuff myself, so I'm just guessing really.
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:20 PM
    The asset manifest that they maintain might be really important
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:20 PM
    Only other way to keep support for _redirects would be if they parsed it and kept a list of those routes (either in the asset manifest or elsewhere).
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:20 PM
    But massive pain for them to do that.
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:21 PM
    Never mind!
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:21 PM
    https://github.com/sveltejs/kit/blob/master/packages/adapter-netlify/index.js#L58
  • g

    Greg Brimble | Cloudflare Pages

    11/24/2021, 2:21 PM
    They're already doing stuff for Netlify's _redirects file.
1...181920...392Latest