Being produced we run tomcat behind apache, in development bare tomcat. How do i know within the Servlet class if it's running behind apache or otherwise?

If this sounds like to differentiate between development and production atmosphere, then you'll most likely be best by getting this completely beneath your control rather than ad-hoc speculating (that will eventually break).

This may be "Is feature X occur JNDI?" or "Is property occur c:/ourproject.qualities". You shouldn't depend on items like "is class X loaded from the file or found in the jar" (since which will break should you change application servers) or "Is http header line X present" since that's from your control and it also may break if someone else is applying Apache like a frontend accellerator.

So, explicit configuration - it is possible very easily :)

This is dependent how your Apache is speaking to Tomcat.

Whether it's connected via HTTP (mod_proxy), you should check request.getRemoteAddr(). It will likely be the IP from the Apache, most likely your internal IP. You may also check "Via" header to ascertain if Apache can there be.

Whether it's connected via AJP (mod_jk/mod_proxy_ajp), you should check request.getLocalPort() to ascertain if it is the port of the JK connector.