To follow up on Andrej’s suggestion, the following bit of Java should return the Host header as a String in a Java action.
Hope this helps.
Assuming that when the user navigates to either URL a microflow is called as a home page you can use a java action to get information about the request. For more, details see
The host info must be somewhere…