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 ...
12
votes
5
answers
17k
views
NextJS ImageError: Unable to optimize image and unable to fallback to upstream image
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: Unable ...
Advice
0
votes
0
replies
46
views
How to properly build an HR Management System using Laravel (API) + Next.js (frontend) with token authentication and middleware?
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 ...
1
vote
1
answer
79
views
Zustand persist doesn't execute in testing
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 {
...
2
votes
1
answer
3k
views
Getting error "Could not find or load main class weblogic.Admin " while connecting to weblogic server
I am trying to run below command in shell script but i am getting error like:
Error: Could not find or load main class weblogic.Admin
${SUN_JAVA_HOME}/bin/java -classpath $CLASSPATH weblogic.Admin -...
0
votes
1
answer
465
views
Advanced Scrapy use Middleware [closed]
I want to develop many middlewares to be sure websites will parse.
This is the workflow I think:
First try with TOR + Polipo
If 2 HTTP errors, try without TOR (so website know my IP)
If 2 HTTP errors,...
7
votes
4
answers
19k
views
Call controller's action method from middleware
My middleware class is in different class library project and controller is in different project. What I am trying to do, if specific condition does not meet then redirect to the Custom Controller/...
6
votes
1
answer
1k
views
ASP.NET Core 3.1 Debugging Built-In Pipeline
Thanks to the extensive ASP.NET Core documentation, we know what is happening at high-level but I also want to dive deep to understand what is exactly happening while built-in middlewares are ...
8
votes
5
answers
10k
views
Laravel Broadcast - Combining multiple middleware (web, auth:api)
I am using Laravel Event Broadcast and Pusher to utilize websockets both on my API and Web. If I try them individually, both work fine. What I mean is:
Broadcast::routes(['middleware' => 'web']); /...
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
vote
2
answers
1k
views
Middleware Laravel 11?
I want to define middleware in my Laravel project, this is my web.php file, when I try to check the auth, I get an error Route [login] not defined. Please help me define middleware in Laravel 11 in ...
91
votes
7
answers
188k
views
Difference between frontend, backend, and middleware in web development
I was wondering if anyone can compare/contrast the differences between frontend, backend, and middleware ("middle-end"?) succinctly.
Are there cases where they overlap?
Are there cases where they ...
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
1
answer
372
views
URL-Encoding Issue When Storing Stringified Objects in Cookies in Next.js Middleware (v13.4)
I'm trying to save a stringified object in cookies within a middleware, but the value is being URL-encoded. For example, {name:123} turns into: %7Bname%3A123%7D.
I don't encounter any issues when ...
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);
});
...
3
votes
3
answers
4k
views
NextJS - NextAuth: getToken always return null in middleware.ts
I can't get the token data using getToken({req, secret}), always return null.
Next JS 13.1.1 and next-auth 4.3.4
package.json:
{
"name": "frontend",
"version": "...
-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 ...
0
votes
1
answer
557
views
Target class [role] does not exist in Laravel 11 Middleware Routes
I'm using Laravel 11 and I'm trying to implement middleware. It gives out the above error but I am very certain it does exist.
web.php
Route::get('/admin', [App\Http\Controllers\HomeController::class, ...
1
vote
0
answers
139
views
Internal server error "Cannot read properties of undefined" during Google OAuth
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 ...
1
vote
2
answers
820
views
How to catch or process RequestValidationError exceptions differently in a FastAPI middleware?
How to correctly combine RequestValidationError exception handlers, such as:
@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request, exc):
response = ...
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 ...
0
votes
0
answers
44
views
How to configure middleware to run and be debugged in next.js
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 ...
42
votes
2
answers
67k
views
How to write a custom FastAPI middleware class
I have read FastAPI's documentation about middlewares (specifically, the middleware tutorial, the CORS middleware section and the advanced middleware guide), but couldn't find a concrete example of ...
3
votes
1
answer
3k
views
Laravel 5 multiple "dashboard" route for admins and managers
(I have asked this question before, and did find a way around which worked for a while, but soon got out of hand. So now I am looking for a perfect solution to achieve this, the Laravel way.)
The ...