-1

Sorry for this newbie's question but I'm learning network.

Long story short : I have a web application separate in 3 modules access at :

  • https://server1:4353/module1
  • https://server1:4858/module2
  • https://server2:4959/module3

I would like to implement something like : user access to https://server3/module{1/2/3} and route to the good server. Ideally, user only see the "simplified" URL.

Something like a proxy but I don't know the real "tehnical name" so I can't find some solutions/how to.

Could ypu help me please ?

1 Answers1

0

You are seeking to have a unified entry point for accessing application resources. This can be achieved through a reliable reverse-proxy or a forward-proxy. Here is an excellent explanation on the differences.

You may achieve your requested action through the following Perl script.

#!/usr/bin/perl

use strict;
use warnings;
use mojolicious::Lite;

# reverse proxy to 127.0.0.1:1234
get '/module1' => sub {
    my $c = shift;
    $c->proxy_to('http://127.0.0.1:4353');
};

get '/module2' => sub {
    my $c = shift;
    $c->proxy_to('http://127.0.0.1:4858');
};

get '/module3' => sub {
    my $c = shift;
    $c->proxy_to('http://127.0.0.1:4959');
};

Your environment type was not defined. If the system is in production, you may wish to look into Hypnotoad. Otherwise, the internal app->start would be sufficient.