Spring Boot returning localhost url instead of actual domain URL for Application deployed in AWS
My Spring Boot application is deployed in AWS. Now my application is running on a private network in AWS and it can be accessed only via a load balancer. Load Balancer receives the actual Request with default domain (say https://example.com/rest/getAllEmployees). Now this request goes to AWS EC2 instance running my application which runs on 8080 port. Now in my code, I am trying to get the actual Request URL using request.getRequestURL(), which is returned as http://localhost:8080/rest/getAllEmployees But it should have been https://example.com/rest/getAllEmployees
How do I fix this?