reading http host: header

My mendix application two different custom domains configured. I want to be able to know the origin or host of http request. In other words I want to know which domain was typed by the user in his browser. Was it domain1 or domain2? The easiest way is to be able to parse the host header from http request. But I am not sure how to do it. I am also open to any other way – my goal is to be able to tell which domain the request was for.
2 answers

To follow up on Andrej’s suggestion, the following bit of Java should return the Host header as a String in a Java action.

return getContext().getRuntimeRequest().get().getHeader(“Host”);

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…