4,672 questions
1
vote
1
answer
52
views
Passing user data from NextJS middleware to the client component
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 ...
1
vote
0
answers
21
views
Bun + Express on Vercel: How to Modularize Routes from Separate Files?
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 ...
0
votes
0
answers
109
views
A wrapper route to simulate a FastAPI request [duplicate]
My goal is to have a special route which receives name and payload for any other route and then (after doing some unpacking and decoding) call the target route which I prefer to go through HTTP ...
-4
votes
1
answer
64
views
How to restrict routes in next js
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 ...
2
votes
1
answer
118
views
Trying to write a unit test to test a fastapi app with a middleware that changes the request.url.path
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="...
0
votes
0
answers
38
views
Can't access headers.origin in NextJS middleware (App router)
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('...
0
votes
0
answers
26
views
Is the route handler in Express also considered part of the middleware chain? [duplicate]
I understand that middleware functions in Express use the (req, res, next) signature and are added using app.use()
But since a route handler also receives (req, res) or even (req, res, next), is it ...
2
votes
1
answer
172
views
How to get remaining ASP.NET Core session expiry time to return it to the client?
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);
});
...
1
vote
0
answers
21
views
How to integrate Apitally middleware in LoopBack 4 so it applies to all API routes?
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 ...
0
votes
1
answer
216
views
Why is auth:sanctum used on api routes and not on web routes?
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 ...
0
votes
1
answer
68
views
How to implement lazy initialization of authjs config in nextjs?
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 ...
2
votes
1
answer
134
views
Is this safe when it come to prevent requests from outside the own website?
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 ...
-1
votes
1
answer
61
views
redux thunk pattern composing middleware calls
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 ...
1
vote
1
answer
62
views
vercel not redirecting to previous page
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 ...
0
votes
1
answer
80
views
Why does setting CultureInfo.CurrentUICulture and using RequestCultureFeature not change the language in ASP.NET Core?
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 ...
0
votes
1
answer
63
views
JWT Token is set in cookies but is always undefined in Next.js middleware
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 ...
0
votes
1
answer
44
views
middleware doesn't recognize session when using server actions
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, ...
0
votes
1
answer
157
views
Next.js Middleware: URL rewrite works in development but doesn't work in production
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 ...
1
vote
2
answers
125
views
Express Req.Query initialization remains empty
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';
...
0
votes
0
answers
24
views
Empty HTTP POST request going unhandled in Express.js server
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
...
0
votes
2
answers
56
views
IStartupFilter for exception handling in .NET integration tests not capturing the exceptions
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 ...
0
votes
0
answers
18
views
NextJS midleware flow of cookies / headers
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 ...
0
votes
0
answers
16
views
Auth middleware fails to check for the session
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 ...
0
votes
1
answer
55
views
Any way to customize token endpoint when using Microsoft.AspNetCore.Authentication.OpenIdConnect middleware in ASP.NET Core
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 ...
1
vote
2
answers
144
views
Best way to update user infos in frontend from stripe webhook
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 ...