Skip to content

adapter-cloudflare ignores _redirects config for cloudflare pages  #9138

@nosovk

Description

@nosovk

Describe the bug

Cloudflare provides functionality to handle redirects using _redirects config file (doc)
When you try to use Cloudflare pages redirects with svelte kit project, then Cloudflare redirects are ignored.
It seems that __routes config, generated by sveltekit covers all routes with *
image

  "include": [
    "/*"
  ],

It means that all requests handled by worker script, before being passed to redirect.

Proposed solution:
add contents of _redirects to exclude section, like static assets.

Reproduction

Sorry, but I can't provide public Cloudflare account as reproduction.
I can only say that problem exists in any svelte kit project deployed to cloudflare pages.

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
    Memory: 7.43 GB / 31.88 GB
  Binaries:
    Node: 18.12.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.15 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.19.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (110.0.1587.50)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @sveltejs/adapter-cloudflare: 2.0.2 => 2.0.2
    @sveltejs/kit: ^1.7.2 => 1.7.2
    svelte: ^3.55.1 => 3.55.1
    vite: ^4.1.1 => 4.1.2

Severity

blocking an upgrade

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions