Skip to main content
Filter by
Sorted by
Tagged with
Best practices
0 votes
0 replies
18 views

I have a Next.js customer-facing website that can be reached by many different domains. Each domain represents a different business, and depending on the domain we need to load that business’s content ...
Nico's user avatar
  • 53
-1 votes
0 answers
38 views

I’m using Next.js (App Router) where authentication is handled by the backend. The backend sets access and refresh tokens in HttpOnly + Secure cookies, so the frontend cannot read token values (which ...
Ch Muzammil's user avatar
1 vote
1 answer
137 views

I have a small app where users have to subscribe to post topics. I use Laravel Cashier with Stripe and it works fine. I have created a middleware to check if auth::user() is subscribed or not : public ...
Gastono's user avatar
  • 33
1 vote
1 answer
112 views

I want to pass the data from the NextJS middleware to the client component. I am using NextJS for the frontend, and an Express API for the backend. I could do it with X-Headers but what I want to send ...
GlicyDev's user avatar
Best practices
0 votes
3 replies
74 views

Adding [ApiController] on a controller class has various benefits. Especially the automatic model validation and problem details parts. The problem with this attribute is that it's easy to forget to ...
LLL's user avatar
  • 3,781
1 vote
0 answers
54 views

I'm deploying a Bun + Express application to Vercel. Locally, my Express app works perfectly with routes defined in separate files and imported into index.ts. However, on Vercel, the deployment ...
Dev Ayush's user avatar
  • 143
Advice
0 votes
0 replies
60 views

I'm building an HR Management System using: Backend: Laravel Frontend: Next.js Authentication(SPA): Laravel Breeze (already set up for backend) I'm a beginner in Next.js, and I’m a bit stuck on how ...
Shashi Kelum's user avatar
1 vote
1 answer
92 views

I am doing unit testing for my project. This is the code I want to test: import { create } from "zustand"; import { persist } from "zustand/middleware"; interface LanguageState { ...
Lollypop123445's user avatar
-4 votes
1 answer
75 views

I need want to send the only authenticated user to the /chat route in next js how to do ut using the middleware? Although I created a middleware and place it inside the root folder it dosen't detect ...
Sudam Ranasinghe's user avatar
2 votes
1 answer
102 views

I’m building an authentication system with Express + JWT + Cookie. I have a middleware userAuth that decodes the token and puts the userId into req.body. Here is the code: import jwt from "...
Ridwan Anugrah's user avatar
2 votes
1 answer
161 views

This is the code below. I want to test a request coming in that has part of its path prefixed by external means. This middleware removes it before servicing the request. app = FastAPI( title="...
Kevin Piotrowicz's user avatar
0 votes
0 answers
57 views

When deployed, it fails Cookie validation Bypass Vercel firewall rules for API routes even though cookie + header is seen from the browser middleware.ts import { NextResponse } from 'next/server'; ...
Dumindu Jayasekara's user avatar
0 votes
0 answers
57 views

I'm trying to follow the basic tutorial provided by NextJS to setup a middleware for my API. When trying to restrict origin (for testing purposes) to http://localhost:3000, the request.headers.get('...
Horkos's user avatar
  • 411
0 votes
2 answers
314 views

I’m working on a Next.js 14 app with the App Router and next-auth@5. I followed the official Next.js Learn guide on authentication, except I replaced email with username in the database. I set up ...
Noctyris's user avatar
0 votes
1 answer
193 views

I was recently in a technical discussion with a senior developer and was asked: What is the difference between RequestDelegate and Middleware in ASP.NET Core? I have already visited the following ...
phougatv's user avatar
  • 1,060
2 votes
1 answer
227 views

I'm working on an ASP.NET Core Web API where I use session middleware with a configured idle timeout, e.g.: services.AddSession(options => { options.IdleTimeout = TimeSpan.FromMinutes(20); }); ...
Tom's user avatar
  • 1,344
0 votes
1 answer
123 views

I'm new to TYPO3 v13 and am currently trying to write a small login middleware, really simple at first. But somehow I can't get any further with $request->getAttribute(‘fe_user’). It always returns ...
user30962528's user avatar
1 vote
0 answers
24 views

This setup only seems to work when I update or refresh my OpenAPI (Swagger) spec. When I call real API endpoints, apitallyRouter middleware doesn’t get triggered at all (no logs, no requests sent to ...
Doni Abdumutalibov's user avatar
1 vote
0 answers
242 views

I created authentications using Better-Auth and Google as the auth client. I have the correct URL for the authorized JavaScript origins and for the authorized redirect URL and I believe my set up is ...
Elijah Davis's user avatar
0 votes
1 answer
277 views

I am using Laravel sanctum SPA auth to protect my routes/api.php routes. Instead of manually implementing the routes and controllers for authentication, I am using Laravel Fortify. Now Fortify adds ...
Nelize du Toit's user avatar
0 votes
0 answers
59 views

Ultimately, I want to route requests to pages within subdomains in my next.js application. If I specify the correct subdomain in a route, I believe that I need to have a middleware.ts file under the ...
IMOsiris's user avatar
  • 155
0 votes
1 answer
82 views

How to implement lazy initialization of authjs (v5 beta) config in nextjs 14 without encountering the error Error: The Middleware "/src/middleware" must export a middleware or a default ...
Tejas's user avatar
  • 27
0 votes
1 answer
130 views

What is the difference between the methods ctx.AbortWithStatusJSON() and ctx.JSON()? As I understand it, the first one calls TWO methods inside itself - Abort(), which interrupts the processing of the ...
DimaMsuVmk22's user avatar
2 votes
1 answer
140 views

I am intending to specify the single origins where I want my different endpoints to receive requests from. After looking at different options I thought that this might be the simplest way, and it ...
sg_b's user avatar
  • 23
1 vote
1 answer
202 views

Next.js allows you to create routing groups to organize your project. I would like to use this information in a middleware to distinguish private groups that need authentication from public routes. E....
René Link's user avatar
-1 votes
1 answer
67 views

I'm sure this has been asked and answered, but maybe I'm not able to phrase it correctly to find the right results. Say I have two redux middleware operations: a call to create an asset entity in the ...
micahg's user avatar
  • 36
3 votes
2 answers
9k views

I am currently working with Laravel 12.13 and facing an issue with CORS. I have configured the HandleCors middleware and the CORS settings in my application, but I am still getting CORS errors when ...
Anna Pons's user avatar
1 vote
1 answer
65 views

user redirected to login page after a trying to access a protected page. I am storing the protected page url in search params and after login redirect to that page. (my approach works on localhost ...
Mahadi Hasan's user avatar
0 votes
0 answers
113 views

I'm implementing authentication middleware in a Next.js (v13+) application using NextAuth.js, and I'm encountering an error when trying to validate the session token. The error occurs in the oidc-...
user avatar
0 votes
1 answer
97 views

I'm working on an ASP.NET Core web application with custom localization using JSON files. I'm trying to change the language at runtime and reflect it immediately in the current request. Here's what I ...
Soner Kochan's user avatar
0 votes
1 answer
138 views

I'm building my web app with Next.JS and React JS. I'm currently using middleware for some tasks like checking user's authentication while accessing the URL and refreshing tokens if needed. However, I ...
Hoangdz's user avatar
  • 333
0 votes
1 answer
90 views

I'm facing an issue in my Next.js 15 application. I am setting the jwtToken in the cookies when a user logs in. I have verified this through the browser's Application tab in the developer tools, where ...
Ali Ahmed's user avatar
0 votes
1 answer
80 views

Hello I want to add a middleware to implement a filter request in my frontend. Basically the workflow is the following: User login in page localhost:3000/auth Backend replies ok with access_token set ...
El Pandario's user avatar
0 votes
1 answer
51 views

after some work i found out that when using server actions to hit some route handler the session will be undefined because server actions run on the server without a request context from the browser, ...
aasem shoshari's user avatar
0 votes
1 answer
248 views

I have an Azure Durable Function that worked before I added custom middleware. Do Azure Functions work with custom middleware? I've added the middleware to manage custom authentication and to ...
EnenDaveyBoy's user avatar
0 votes
1 answer
209 views

OBS: text translated with the help of AI I am trying to use a middleware in Next.js to rewrite the URL for a subdomain (like dividas.dominio.com) to /dividas. The behavior works correctly in the ...
Fernando Leão's user avatar
0 votes
0 answers
35 views

My team and I are building a web app with Next.JS, and we are mainly working on Front-end. The back-end was already implemented with another language because it's shared with our mobile apps. Now I'm ...
Hoangdz's user avatar
  • 333
1 vote
2 answers
153 views

I have this alias middleware which supposed to manually initialized the queries. exports.aliasTopTours = (req, res, next) => { req.query.limit = '5'; req.query.sort = '-ratingsAverage,price'; ...
Dumb_Developer's user avatar
0 votes
1 answer
441 views

I’m working on a front-end project using Next.js 15, where the backend is separate and responsible for user authentication. The flow is as follows: I send the user credentials (email and password) ...
Amr Gaafer's user avatar
0 votes
0 answers
29 views

I have an Ubuntu image based docker container working as a development environment. Inside this container, I have my express app. Below are the code files. // Start the Express Server - index.ts ...
Aakash's user avatar
  • 33
0 votes
2 answers
70 views

I am following the documentation of slim 4 middleware at Docs I was able to implement the before middleware. But not sure how to implement after middleware. It says the DI should be used but the code ...
Alaksandar Jesus Gene's user avatar
0 votes
2 answers
62 views

I have an integration test using a WebapplicationFactory in .Net 9 to spin up the main Program.cs and hit endpoints. My problem is often an endpoint will return a generic 500 error when an unhandled ...
The Lemon's user avatar
  • 1,547
0 votes
1 answer
56 views

I'm using Scrapy's built-in CrawlOnce middleware, and when I stop and restart a job, I sometimes get this error: Traceback (most recent call last): File "/app/tasks/crawl.py", line 250, in ...
ProblemSolver's user avatar
0 votes
0 answers
20 views

I have a confusing situation with NextJS and session cookies and middleware, the flows are: New user hits site -> middleware creates a new anon session token and sets the set cookie header in the ...
Rob Sanders's user avatar
  • 5,423
0 votes
0 answers
48 views

Need to catch HTTPException raised in route in middleware. Raise exception in route: @worker.get("/v1/error_400") async def error_400(): raise HTTPException( status_code=400, ...
Unknown.Vagrant's user avatar
0 votes
0 answers
22 views

I have multiple middlewares at the same file, if user is not logged in; the auth middleware will redirect user to login page, the problem is even when user is logged in it will return login page ...
Aasem Shoshari's user avatar
1 vote
1 answer
2k views

I want to configure rate limiting with SlowAPI (in-memory, without Redis Cache etc.), but I don't want to add the @limiter.limit() decorator seperately for every endpoint. So, something I don't want ...
Jan's user avatar
  • 31
0 votes
1 answer
68 views

I'm trying to authenticate using an identity provider that has its token endpoint on /profile/oidc/token instead of the usual /oauth/token endpoint. Is there any way to customize this? I'm always ...
BG931c's user avatar
  • 1
0 votes
0 answers
19 views

Intro Hello, I am using the following files for my NextAuth configuration. When I use a server action inside the authorize method I get the edge error. I tought that the authorize method does not run ...
uivlis's user avatar
  • 1
1 vote
2 answers
165 views

I am currently finalizing a payment system in my ReactJS - FastAPI web app, and I'm facing a problem. Indeed, I use stripe for payments and I use the stripe webhooks system to update the user infos in ...
Digicem's user avatar
  • 31

1
2 3 4 5
94