Each Elastic Beanstalk environment has an associated URL (on the Elastic Load Balancer with the environment). In the Java/Tomcat flavor of EB, is there a way to query that URL, so it can be used dynamically within the application?
My current workaround is to pass the URL in as a parameter to the container, but that doesn’t work nicely when switching environment URLs for live deployment.
Yes, it does.
The Backend Loadbalancer forwards additional URLs when being called.
Check the Request Headers “Host”, and “X-Forwarded-Host”