Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middleware.ts does not trigger in nextron #490

Open
alieldeba opened this issue Aug 23, 2024 · 3 comments
Open

Middleware.ts does not trigger in nextron #490

alieldeba opened this issue Aug 23, 2024 · 3 comments

Comments

@alieldeba
Copy link

Hey @saltyshiomix,

I want to make a middleware that redirects user to /home if he goes to / and I have made this middleware file:

import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";

export function middleware(request: NextRequest) {
  return NextResponse.redirect(new URL("/home", request.url));
}

My problem is that it does not redirect user to /home and does not work at all.

this is my project structure:

image

and I want to know if I can run my nextron app with --turbo flag

@alieldeba
Copy link
Author

attention please as I do not have time and should make this project as quickly as possible
@cellis @jogoodma @ColeTownsend @beinbm
thanks.

@alieldeba
Copy link
Author

Middleware worked after I have deleted the "output": "export" line in next.config.js file

image

@alieldeba alieldeba reopened this Aug 25, 2024
@alieldeba
Copy link
Author

The build failed it should be "output": "export" in the build but it works fine in dev mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant