4

Problem: I have two web applications which were created by using JAVA and PYTHON respectively.

The JAVA application runs using Tomcat server on the port number 8000. The PYTHON application uses web.py and runs on the port number 8080. The Python (API) performs a back-end job and Java (UI) acts a front-end guy.

In my local Ubuntu machine, these applications were working perfectly. However, I have to make this application run in my QA machine in which only ports 80 and 443 are open and all the remaining ports are restricted. I tried using authbind to run java on port 80 but it failed.

Is there any other ways to redirect the HTTP requests to their respective web services and port number internally using URL Filtering ? If there any other methods kindly share the information about it.

Thanks in advance.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
VjyAnnd
  • 51
  • 3
  • On the QA machine, does the configuration work fine **from within** the machine, that is at the `localhost` address? –  Aug 01 '16 at 13:47
  • you could try using a proxy server on port 80 which is capable of detecting to which server it should go and redirect the request to the correct server – konqui Aug 01 '16 at 17:36

2 Answers2

1

The standard solution for this is to use a front-end server which dispatches the requests to the appropriate “real” server, typically based on the host name. This is called a reverse proxy. Nginx is very often used for that. Start with the tutorial.

Here's how the configuration (/etc/nginx/nginx.conf) of a reverse proxy with two backends looks like:

server {
    server_name java-app.example.com;
    proxy_pass http://localhost:8000/;
}

server {
    server_name python-app.example.com;
    proxy_pass http://localhost:8080/;
}

Of course there are many more options that may be useful.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
0

You can install and configure nginx as reverse proxy so your request to the TCP:80 will be redirected to different actual ports basing on your FQDN in the HTTP request.

Take a look here for an example of nginx configuration.

Tim Connor
  • 74
  • 1