middleware Questions
9
Solved
I want to pass some variable from the first middleware to another middleware, and I tried doing this, but there was "req.somevariable is a given as 'undefined'".
//app.js
..
app.get('/so...
Cardew asked 18/9, 2013 at 14:41
2
I'm learning to use Nuxt, and currently trying nuxt-bridge which comes with most of Nuxt3 functions, while keeping nuxt-auth-next module compatibily which I need.
As of now I'm working on my API, u...
Almatadema asked 15/8, 2022 at 13:37
2
Solved
I have a simple middleware setup that checks if the user is logged in using a boolean from the zustand store, and redirect the user to the login page accordingly. This was as per the docs
import {...
Cavalierly asked 24/8, 2022 at 16:53
3
I'm trying to set a cookie after the action is executed, struggling to get this working. I managed to see the cookie if I set it from a controller, but not from a middleware.
I have played with the...
Bria asked 6/6, 2019 at 9:30
3
Solved
I created middleware and add matcher /((?!api|_next/static|_next/image|favicon.ico|auth/login).*) in config middleware.
When I try to run npm run dev.The result comes out like this:
ImageError: Una...
Osyth asked 19/5, 2023 at 7:1
3
Solved
By default, a NextJs middleware is run using the Edge runtime and from what I understand this is because the middleware is meant to be run on the edge network instead of the main server (being run ...
Edva asked 4/5, 2022 at 12:51
2
I am trying to implement route protection using the new Next.js 12 middleware function. But it occurs to me that every time I try to access the session I get null. Hence not getting the expected re...
Shoemaker asked 29/11, 2021 at 16:25
13
Solved
How can I enable CORS on my Django REST Framework?
the reference doesn't help much, it says that I can do by a middleware, but how can I do that?
Ninette asked 3/3, 2016 at 0:32
1
I'm currently working on a Next.js 13 project and I'm trying to understand the role of middleware within the framework. In Next.js 13, is middleware considered server-side or client-side?
I have lo...
Pontus asked 5/7, 2023 at 12:52
4
Solved
Developing an app with laravel I realised that what can be done with Policy can exactly be done with Middleware. Say I want to prevent a user from updating a route if he/she is not the owner of the...
Warrick asked 26/1, 2016 at 16:50
6
I got this handle in a middleware called rolMiddleware:
public function handle($request, Closure $next, $roles)
{
//dd($request->user());
foreach ($roles as $rol) {
if ($request->user()-&...
Germinal asked 28/4, 2017 at 17:15
3
export default defineNuxtRouteMiddleware(async(to, from) => {
const loggedIn = useState('loggedIn', () => false)
if(loggedIn.value == false) {
if(to.path == '/auth/login') {
await navigat...
Sporophore asked 2/3, 2023 at 5:5
2
Solved
ENVIROMENT
NextJS: 12.2.2
NextAuth: 4.10.3 (latest)
Provider: Credentials
Browser: Google Chrome
Node: LTS
ISSUE
Hello everyone
I'm using NextAuth for authentication with credentials provide...
Haro asked 10/8, 2022 at 6:26
4
Solved
Example code is available on https://github.com/baumgarb/reverse-proxy-demo The README.md explains how you can re-produce the issue if you clone the repo.
I have an API Gateway and a downstream se...
Initiative asked 6/11, 2019 at 9:33
2
Hey guys, can I use axios with next.js 13 and still get the same results of their extended fetch api version with cache and revalidate configs ??
Is axios going to this web-standard thing directi...
Sprage asked 16/5, 2023 at 15:1
3
Solved
Let's say I have a route pointing to middleware;
Route::get("/user/{id}", ['middleware' => 'auth', function ($id) {
}]);
And my middleware code is as follows:
public function handle($reques...
Garner asked 5/12, 2016 at 13:32
3
In real app, we write:
export class AppModule implements NestModule {
constructor() {}
configure(consumer: MiddlewareConsumer) {
consumer.apply(JwtExtractionMiddleware).forRoutes({
path: 'gra...
Symbolize asked 13/9, 2018 at 14:18
1
I have been trying to make this work for a while and just can't seem to find any solution in the docs for the problem I have. The situation is this, I want a user to sign in using nextauth.js, and ...
Drought asked 26/6, 2023 at 11:45
3
i have declare a middleware that check role of every routes in nuxt.config.js. but want to disable in some pages.
// in nuxt.config.js =>
router: {
middleware: ['role']
},
// in middl...
Wyattwyche asked 27/8, 2021 at 18:35
2
i just trying Next Js 13 middleware feature. But i confuse how to passing data from middleware to components/page/api.
For example i try to pass payload or who user is currently loggin.
Normally wi...
Parallelize asked 3/2, 2023 at 3:57
3
Solved
I have a middleware on a Next.js project, and I want to negate my /api/* route.
In other words, I want middleware to run for every route except anything that starts with /api/. I couldn't find an e...
Henriquez asked 19/8, 2022 at 10:41
3
I have this code in /pages/api/_middleware.js:
import { getSession } from '@auth0/nextjs-auth0'
export default async function middleware(req, ev) {
const session = await getSession(req)
console....
Fite asked 18/11, 2021 at 15:37
1
I am using the following middleware to create a redirect if the user is not on the sign-in screen. This is just a test case. Eventually, the condition would check for a valid auth session and condi...
Rector asked 27/5, 2023 at 18:38
2
Solved
I have a simple FastAPI setup with a custom middleware class inherited from BaseHTTPMiddleware. Inside this middleware class, I need to terminate the execution flow under certain conditions. So, I ...
Latish asked 16/5, 2023 at 20:3
2
Solved
I'm having a little trouble understanding the difference of application between a reducer and middleware. A number of sites describe middleware even giving precise definitions:
It provides a thi...
Abiding asked 21/7, 2017 at 19:8
© 2022 - 2024 — McMap. All rights reserved.