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

398
Views
Node.JS + Apache - Cannot GET

I'm trying to use Apache and Node.JS at the same time but it is not working as expected.

// Apache 
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName mydomain.com
  ProxyPass / http://localhost:3000/
  ProxyPassReverse / http://localhost:3000/

And for my server.js

// Node
  const express = require ('express');
  const server = express();

  server.get('/', function(req,res){
    return res.send('The code works fine here');
  });

  server.get('/foo', function(req,res){
    return res.send('Here => Cannot GET /foo');
  });

  server.get('/foo2', function(req,res){
    return res.send('Here too => Cannot GET /foo2');
  });

  server.listen(3000, function() {
    console.log('server is only working for "/" ')
  });

mydomain.com works perfectly, but I cannot find a way to make all the other sub-domains mydomain.com/* to work. Can someone give me a light?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use Apache reverse proxy

Add this configuration to your apache conf.

ProxyPass "/nodeapp" "http:/localhost:8443"

You can access node application by http://www.example.com/nodeapp

A reverse proxy is a type of proxy server that retrieves resources on behalf of a client from the server. These resources are then returned to the client as if they originated from the web server itself.

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!