Tabla de Contenidos

Apache config

Ver orden en que usa los VirtualHosts
apache2ctl -S

Forzar redirects con el servername del virtualhost
UseCanonicalName On

Ver variables del servidor
<?php phpinfo(INFO_VARIABLES); ?>

Proxy Pass

URL con caracteres raros
'nocanon - Pasa la URL sin canonicalizar tal como la recibe. - Sirve para servicios REST que necesitan pasar parámetros con acentos ProxyPass /webservice balancer://api/webservice nocanon

Excluir un path del ProxyPass
ProxyPass /ciudades/aulavirtual ! ProxyPass /ciudades/ balancer://ciudades_hcluster/ciudades/ ProxyPassReverse /ciudades/ balancer://ciudades_hcluster/ciudades/

Pasar / en la url
AllowEncodedSlashes

Sobreescribir página de error
ProxyPass /error-documents ! ErrorDocument 503 /error-documents/503.html Alias /error-documents /home/stefan/repos/empfehlungsbund/public

Cache

Directivas que afectan al cache CacheQuickHandler Off (2.4) para que revise si la url está permitida antes de buscar en el caché UseCanonicalName On Todos los accesos al virtualhost usan la misma url cacheada

Apache 2.2

# Log
SetEnv CACHE_MISS 1
Header append CacheMISS %`CACHE_MISS`e
LogFormat "%h %l %u %t \"%r\" %>s %b MISS:%`CACHE_MISS`e %`Age`o" cache

Apache 2.4

Evitar que sirva el cache antes de procesar las directivas de url (para que no traiga del cache cosas prohibidas por location)
Sólo funciona en la configuración general del módulo
CacheQuickHandler off

# Enable the X-Cache header
CacheHeader on

# Enable the X-Cache-Detail header
CacheDetailHeader on

# Log
LogFormat "%h %l %u %t \"%r\" %>s %O %`cache-status`e %`Age`o" cache

What Can be Cached?

The full definition of which responses can be cached by an HTTP cache is defined in RFC2616 Section 13.4 Response Cacheability, and can be summed up as follows:

Problemas con proxypass en apps que no ven la IP del cliente

Si se le cierra la sesión con el mensaje de que la IP del cliente cambió y hay dos apaches de frontend que hacen reverse proxy.

mod_rpaf
It changes the remote address of the client visible to other Apache modules when two conditions are satisfied. First condition is that the remote client is actually a proxy that is defined in httpd.conf. Secondly if there is an incoming X-Forwarded-For header and the proxy is in it's list of known proxies it takes the last IP from the incoming X-Forwarded-For header and changes the remote address of the client in the request structure. In this case rpaf translates the remote address 192.168.20.50 to real client address sent in X-Forwarded-For header.

RPAFsethostname On
RPAFproxy_ips 192.168.13.31 192.168.13.32