Skip to content

@astrojs/node is not handling redirects on production #7832

@fprl

Description

@fprl

What version of astro are you using?

2.9.3

Are you using an SSR adapter? If so, which one?

Node

What package manager are you using?

npm

What operating system are you using?

Mac

What browser are you using?

Chrome

Describe the Bug

Hello everyone, thanks a lot for checking this.

I set some redirects in astro.config.mjs:

redirects: {
    '/my-account/my-bookings': '/nl/my-account/bookings',
    '/my-account/my-bookings/[hash]': '/nl/my-account/bookings/[hash]',
    '/my-account/my-profile': '/nl/my-account/profile',
    '/en/my-account/my-bookings': '/my-account/bookings',
    '/en/my-account/my-bookings/[hash]': '/my-account/bookings/[hash]',
    '/en/my-account/my-profile': '/my-account/profile',
  },

On dev everything work as expected but running the server will always get you redirected to /.

What's the expected result?

The adapter should respect the redirects.

Link to Minimal Reproducible Example

https://github.com/fprl/astro-redirects-repro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

- P4: importantViolate documented behavior or significantly impacts performance (priority)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions