reading http host: header

0
My mendix application two different custom domains configured. domain1.mycompany.com domain2.mycompany.com 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.
asked
2 answers
4

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.

answered
3

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 

https://apidocs.rnd.mendix.com/6/runtime/com/mendix/systemwideinterfaces/core/IContext.html#getData--

The host info must be somewhere…

-Andrej

answered