'How to use 1 external port for 3 applications

I Have a 3 applications,

React Front using NextJs Spring rest API WildFly server

But so I only have one external port available, I can use some proxy or gateway to access my applications?

I saw Spring cloud Gateway, could run on my external port and redirecting the request for the correctly app? Or is there a better way?

Like this:

  • Request ip:8433/app1 -> localhost:9000
  • Request ip:8433/app2 -> localhost:9001
  • Request ip:8433/app3 -> localhost:9002

Edit One, Spring cloud Gateway code:

@Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
        return builder.routes()
            .route("API", r -> r.path("/api/**").uri("http://localhost:8084"))
            .route("UI", r -> r.path("/ui/**").uri("http://localhost:3000"))
            .route("WILDFLY", r -> r.path("/wildfly/**").uri("https://localhost:8087/wildfly"))
            .build();
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source