Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6814849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:44:15+00:00 2026-05-26T20:44:15+00:00

I have a node.js app that serve static files (html, js, css). Among the

  • 0

I have a node.js app that serve static files (html, js, css). Among the static files, some ajax request are done (with /TEST in the request). I need those request to be proxied to another server running on localhost:213445. The static pages are correctly displayed but when it comes to proxied request it hangs forever…

My code is:

var express = require("express");
var httpProxy = require('http-proxy');
var fs = require('fs');

// Create https server
var app = express.createServer({
    key: fs.readFileSync('privatekey.pem'),
    cert: fs.readFileSync('certificate.pem')
});

// Handle static files
app.use(express.static(__dirname + '/public'));

// Proxy request
app.all('/TEST/*',function(req, res){
  // Remove '/TEST' part from query string
  req.url = '/' + req.url.split('/').slice(2).join('/');

  // Create proxy
  var proxy = new httpProxy.HttpProxy();
  proxy.proxyRequest(req, res, {
     host: 'localhost',
     port: 21345,
     enableXForwarded: false,
     buffer: proxy.buffer(req)
  });
});

// Run application
app.listen(10443);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:44:15+00:00Added an answer on May 26, 2026 at 8:44 pm

    I have the same issue. If you comment out the

    // Handle static files
    app.use(express.static(__dirname + '/public'));
    

    you will see that the the proxy works.

    Not sure how to fix it if express.static is used

    Marak Squires responded to the bug report!

    This is an express problem.
    The Connect / Express middlewares are doing non-standard things to your response object,
    breaks streaming. Try using the raw request module instead of http-proxy.
    If you need proper middleware stack, check out https://github.com/flatiron/union

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Express server that is serving up some static files. Here
We have a node.js app that uses node_msyql , a great little library for
I have a Rails app that sends requests to a Node.js app. The node.js
I've got an app that hosts simple html pages for people. Some of whom
I have a Node.js app using Express that stores data in a mongoDB (locally).
I have a 3-node web farm being managed by IIS7 and Application Request Routing.
I have the following HTML node structure: <div id=foo> <div id=bar></div> <div id=baz> <div
I have a Rails app that allows users to build up a network structure
I have an app that loads records from a binary log file and displays
.NET 3.5, C# I have a web app with a search feature. Some of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.