1

I want to run two web server at the same port. I know you can do this with tomcat and apache for entire domains. But what I'm looking for is a way for jetty to forward traffic to a specific directory to grunt. for example

domain.com

This is handled by jetty

domain.com/frontend/index.html

This is handled by grunt and all other request to pages under frontend. The reason I'm doing this is that we use different server for frontend and backend development and i don't want request to rest services from the front end to be calls to an other domain.

Icy Creature
  • 223
  • 2
  • 5
  • 11

1 Answers1

2

By definition, only a single process can listen on any given port.

That said, you can achieve what you're asking for with a reverse proxy (mod_proxy, HAProxy, nginx, lighttpd).

You'd have to change your web server and jetty listen on other ports (8080 and 8081 for example), have the proxy listen on the "default" port (probably 80 or 443 in this case) and then have it forward the requests to the approprate backend based on the criteria you've listed (URL path starting with /frontend).

GregL
  • 9,370
  • 2
  • 25
  • 36