Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

321
Vistas
remove header X-powered-by Express using @types/express

I have to remove X-powered-by Express header, I found theses solution

app.disable('x-powered-by');

or

app.use(function (req, res, next) {
  res.removeHeader("X-Powered-By");
  next();
});

but in this project we don't use express in a basic way, we import Express this way in multiple files

import {Express} from 'express'; // @types/Express

and then we call Express.multer.file

I'm new on this project and also on backend development, so how can I remove this header using this way and not the basic way ?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

You can still use it the "basic" way:

import express, { Express } from 'express';

const app: Express = express();

app.disable('x-powered-by');
over 4 years ago · Santiago Trujillo Denunciar

0

You can remove header in sequence.ts file like this.

export class MySequence extends MiddlewareSequence {
   async handle(context: RequestContext) {
      const res = context.response;
      res.removeHeader('X-Powered-By');

      await super.handle(context);
   }
}

or use helmet package for security of headers. thus remove headers telling how software is developed

over 4 years ago · Santiago Trujillo Denunciar

0

so, the solution I found was in loopback documentation - Express settings

I just add this to my rest config object :

  const config = {
    rest: {
      expressSettings: {
        'x-powered-by': false,
      },
      ...
      ...
    }
   }
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda