Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

119
Visualizações
Can an express app handle requests made to another server

Total Http/Express noob here. Just messing around and getting stuck.

I have an app set up that is serving static pages from a public dir. I also have the following route:

app.get('*', (req, res, next)=>{
   console.log(req.url)
   next();
});

This logs all the requests that are being made on my app but when one of my static pages requests an image from a different source eg S3 or Google, then that doesn't get logged. Which makes sense as that request obviously isn't hitting any of my routes.

So is there a way that I can get express or node to be aware of those external request? Really I just need to see the URLs that assets are being requested on, similar to the Network tab in Chrome dev tools.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You can do it by sending a 302 redirect from your server to the image in S3, etc. Generally, this is not a good practice because redirected requests take additional browser and network overhead. It's probably OK for a few images, but you likely don't want to do it for all.

You could also proxy the image request. In this case your server would request the image from S3 and then stream the image back to the client. This also has performance impacts on your server.

If you want to know what images were requested and how often, then using log analysis on S3 or other storage resource is probably a better way to go.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda