Skip to content

Role based redirects does not work as intended in dev mode #4320

Open
@nekdolan

Description

@nekdolan

Describe the bug

When you make a role based rewrite (not redirect) on dev mode or live dev mode the rewrite to the page returns 404.
Works correctly on production.
https://answers.netlify.com/t/role-based-redirects-does-not-work-as-intended-in-dev-mode/50667

To Reproduce

Steps to reproduce the behavior:

Make a configuration like the one you see below.

[[redirects]]
  from = "/*"
  to = "/pro/:splat"
  status = 200
  conditions = {Role = ["pro"]}

Put a test.html file in /pro .
Login as user with role set to "pro"
Try to access /pro/test.html at /test.html

Configuration

[build]
  publish = "dist"
  functions = "functions"
[dev]
  publish = "dist"
  functions = "functions"
[functions]
  node_bundler = "esbuild"
[[redirects]]
  from = "/pro/*"
  to = "/:splat"
  force = true
  status = 302
[[redirects]]
  from = "/free/*"
  to = "/:splat"
  force = true
  status = 302
[[redirects]]
  from = "/*"
  to = "/pro/:splat"
  status = 200
  conditions = {Role = ["pro"]}
[[redirects]]
  from = "/*"
  to = "/free/:splat"
  status = 200
System:
    OS: Linux 5.16 Fedora Linux 35 (Workstation Edition)
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
    Memory: 150.58 MB / 15.27 GB
    Container: Yes
    Shell: 5.1.8 - /bin/bash
  Binaries:
    Node: 16.6.2 - ~/.nvm/versions/node/v16.6.2/bin/node
    Yarn: 1.22.11 - ~/.nvm/versions/node/v16.6.2/bin/yarn
    npm: 7.20.3 - ~/.nvm/versions/node/v16.6.2/bin/npm
  npmGlobalPackages:
    netlify-cli: 8.13.2

Expected behavior

The browser should open test.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions