Questions tagged [middleware]

Middleware is computer software that provides services to software applications beyond those available from the operating system. It can be described as "software glue".

Middleware is a software component (or components) that sits "in the middle" between applications and the operating system. Typically, middleware will facilitate application development by providing services such as communications, file access, or thread locking that have a common Application Programming Interface (API) across multiple operating systems.

Communications Middleware is a specific kind of middleware that allows for interprocess communications (on one machine or across a network). The purpose of Communications Middleware is to simplify the designing, programming, and managing of software applications by streamlining the way these applications receive and process data. Communications Middleware simplifies writing communications software while providing sophisticated built-in features, reducing development costs.

Examples of communications middleware include:

4333 questions
1
vote
0 answers

How to add middleware on all the routes in Next js

If we come from an external source to our web page, we have utm parameters added in our url for quite some time(as in only in first page), then if we go to some other route, those parameters disappear. Now I want to retain those utm parameters for…
Muskan Rawal
  • 58
  • 1
  • 9
1
vote
0 answers

Paginate running correctly but not passing objects to client

My paginate function is returning the documents correctly on the console but it's not properly passing them to the client. I have the paginate function set as a middleware below: module.exports.paginatedResults = async (req, res, next) => { …
econobro
  • 315
  • 3
  • 17
1
vote
1 answer

How I can use Pre and post-middlewares | oidc-provider panva

The documentation is not clear for me and I need to validate the parameters data to define if the user is allowed to get his login or not, I am using express too, so I'm so confused with expressApp.use () and provider.use(). Simply, I need to mix…
1
vote
2 answers

Node Express.js Middleware, end Response

validateRegister: async (req, res, next) => { UserModel.findOne({email:req.body.email}, (err, example) => { console.log(example); if(err) console.log(err); if(example) { …
Gamox
  • 13
  • 2
1
vote
1 answer

check header for a specific controller

I need to check that when accessing the BooksController, the header 'X-API-User-Name = admin' is received. I use this documetations https://symfony.com/doc/current/event_dispatcher/before_after_filters.html Code It's my middleware namespace…
Марк
  • 45
  • 7
1
vote
0 answers

Getting wrong headers for Traefik ForwardAuth middleware

I've been trying to develop a custom auth thing for Traefik using Django and the ForwardAuth middleware. Unfortunately, I'm having troubles with the provided headers for my application: My auth app has three endpoints: /auth/, which checks whether…
Gabriel Milan
  • 702
  • 2
  • 7
  • 21
1
vote
2 answers

Is it possible to configure an Azure Relay listener that responds to the local addresses also?

I'm new in the Azure Relay use and configuration. I've developed an API that responds with the Relay mechanism ... now my need is to leave the service bus listeners configured by default in Program (or even in startup) like…
Jacob Vame
  • 11
  • 3
1
vote
1 answer

Why UseWelcomePage is implemented the way it is?

Let's take an example of a very simple middleware which is the WelcomePageMiddleWare. If we want to use it we need to add the line app.UseWelcomePage() to the Configure method of the Startup class. By sneaking into the source code of ASP.NET Core,…
Best_fit
  • 165
  • 7
1
vote
1 answer

json-server returns HTTP 200 instead of 404 for query parameter filtered GET request, what is the best practice here & how can 404 be returned?

Context Attempting to make a HTTP GET request for posts filtered by query parameter authorId=x where x may be a number that may not correspond to any post's authorId. Problem json-server unexpectedly returns HTTP 200 instead of HTTP 404 response…
surajs02
  • 451
  • 7
  • 18
1
vote
1 answer

Express CORS middleware to handle both preflight and normal requests

I have CORS globally configured like this, to handle credentials: app.use(cors({ origin: 'https://example.com', credentials: true })) But on certain routes, I need to allow options requests, so following the documentation, I'm doing something like…
Glenn
  • 4,195
  • 9
  • 33
  • 41
1
vote
1 answer

Unsafe redirect to URL with protocol 'account'

I am trying to redirect to login page with return url through a middleware . I am getting this error so can anyone answer the question why i am getting this error and how to solve this error from django.shortcuts import redirect def…
1
vote
0 answers

Should I use one or more global error handler middleware or manually send error responses in Express?

I hope you're having a good day. First of all, I'm sorry if you think this is a stupid question but I'm genuinely curious as to what you do in your own projects or let's say in a production environment. So I've been using express for quite some time…
Jeffrey
  • 75
  • 9
1
vote
1 answer

Why does my middleware function not work if its called function is not defined in the same file?

I am facing the following problem : Case 1 (working case) : file middleware.ts (library for middleware utils functions) import { NextApiRequest, NextApiResponse } from 'next' import rateLimit from 'express-rate-limit' export function…
Sylvain
  • 113
  • 1
  • 7
1
vote
1 answer

Laravel assign middleware to auth route

I want to assign middelware to the register post route. For example like: Route::post('contact', [ 'as' => 'contact-store', 'uses' => 'ContactmeController@contactUSPost' ])->middleware(\Spatie\Honeypot\ProtectAgainstSpam::class); My…
poashoas
  • 1,790
  • 2
  • 21
  • 44
1
vote
2 answers

Express, request body is {} in middleware, but has content in controller

Here is my server.js: import express from "express"; import mongoose from "mongoose"; import productRouter from "./routers/productRouter.js"; import dotenv from "dotenv"; dotenv.config(); const app = express(); app.use(express.json()); let prof…
Koray Aydemir
  • 310
  • 3
  • 9