Skip to content

[Bug]: 404s with dynamic routes and reverse-proxy using basePath #965

Closed
@audreyshub

Description

@audreyshub

Steps to reproduce

  1. Go to https://www.tourlane.de/traveller-crossing

  2. Login using the following credentials:

    email: [email protected]
    password: netlifytest

  3. On the landing page, click either the "South America" or "Europa" continent chip, or any of the links on the pink sidebar (Inspirationen deutsch or Angebote1)

Expected behavior:
Page is served correctly

Actual behavior:
We get a 404 page

Now repeat the exact same steps but instead of using the reverse-proxy from tourlane.de, visit directly the netlify site (https://traveller-crossing.netlify.app/) you will see that this error doesn't happen. Something interesting to note is that after visiting some of the pages on the netlify site, and going back to try to visit them from the reverse-proxy version (https://www.tourlane.de/traveller-crossing) they will work, as it seems that a cached version is being served.

  1. Visit https://www.tourlane.de/traveller-crossing/inspiration/south-america
  2. you will get a 404
  3. visit https://traveller-crossing.netlify.app/traveller-crossing/inspiration/south-america
  4. page will be served just fine
  5. visit https://www.tourlane.de/traveller-crossing/inspiration/south-america again
  6. page will be served just fine 🤯

There seems to be some configuration off with dynamic routes and reverse-proxy on Netlify using basePath.

This is working in Vercel.

A link to a reproduction repository

No response

Plugin version

@netlify/[email protected]

More information about your build

  • I am building using the CLI
  • I am building using file-based configuration (netlify.toml)

What OS are you using?

No response

Your netlify.toml file

netlify.toml
[build]
  publish = ".next"

[[plugins]]
  package = "@netlify/plugin-nextjs"

[[redirects]]
  from = "/"
  to = "/traveller-crossing"
next.config.js
module.exports = {
  reactStrictMode: true,
  basePath: '/traveller-crossing',
  async redirects() {
    return [
      {
        source: '/',
        destination: '/traveller-crossing',
        permanent: true,
        basePath: false,
      },
    ];
  },
};

Relevant log output (or link to your logs)

Build logs
https://app.netlify.com/sites/traveller-crossing/deploys/61b21a476247e800071ebf01

Metadata

Metadata

Assignees

Labels

type: bugcode to address defects in shipped code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions