Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!