0

Updated:
Project 1: PHP, HTML, CSS, Java, mySQL
Project 2: Angular, Spring Boot, PostgreSQL

I am trying to build the part of Project 1 as separate project (Project 2 which will run independently with its own database) and these two projects will communicate via API calls.

Problem I am facing is : They both should run under same domain (no sub-domain) i.e. Domain will be same across the whole functionality of both projects but internally there are two projects running ( Project 1 + Project 2).

Also, we want to white label the Project 2 so that we can provide it as a service to other tenants.

For e.g. Imagine Amazon.com as Project 1, and as Project 2 I want to maintain all Profile Details of user, Order history, payment history, Invoices. This service (Project 2) I can provide to all other shopping Applications, when user clicks on My Profile (Project 2), it will show all his profile details which are stored in Project 2 database (And behind the scenes both Projects will communicate via API calls )

So if I build Project 2 as part of Project 1 with Separate database then is it possible to run them under same domain? if yes how ? if No then any other ways to achieve it?

Thanks

Rohit
  • 179
  • 3
  • 12
  • Have you seen this article `https://www.devglan.com/spring-boot/spring-boot-angular-deployment`, actually you can deploy it with `Java` bundle. – Rohit.007 Dec 05 '18 at 08:37

1 Answers1

2

You will need a reverse proxy to accomplish that. That is a simple HTTP server running at your domain, that passes the incoming requests (depending on context-roots, subdomain, whatever) to the "backend", which will be either your angular or your Spring-Boot application.

Have a look at this question for an example Nginx configuration (Official documentation).

For the Apache HTTP Server documentation have a look here.

markusw
  • 1,975
  • 16
  • 28
  • Thanks Mark, but I haven't heard about reverse proxy so I will look into that and will come back if I have any doubts. Thanks again – Rohit Dec 05 '18 at 08:25