Configurar Drupal para ejecutarlo en un Docker con un proxypass por delante.

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by oskar_calvo on February 26, 2020 at 8:58am

Buenas.

Tengo en un servidor ejecutándose un docker, que escucha en localhost:8082, pero para acceder a esto uso proxypass de Apache, el problema es que Drupal en vez de escribir la ruta correcta escribe la ruta de docker:

http://localhost:8082/sites/default/files/.... 

Este es mi virtualhost:

 ServerAdmin xxxx@xxxx
 ServerName project.dev.domain.com
 ProxyPass "/" "http://localhost:8082/"
 ProxyPassReverse "/" "http://localhost:8082/"
 ErrorLog ${APACHE_LOG_DIR}/project.dev.error.log
 CustomLog ${APACHE_LOG_DIR}/project.dev.access.log combined

Y esta es la configuración de settings.php que he puesto:

$settings['reverse_proxy'] = TRUE;
$settings['reverse_proxy_addresses'] = ['127.0.0.1'];
$settings['reverse_proxy_trusted_headers'] = \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_ALL | \Symfony\Component\HttpFoundation\Request::HEADER_FORWARDED;

Pero sigue poniéndome mal la ruta de las imágenes.

¿Alguien sabe que estoy haciendo mal?

Gracias.

Oskar

Comments

mod_substitute

Posted by asanchez75 on February 26, 2020 at 9:10am

To override URLs in the html outputted from the proxy you can use

https://httpd.apache.org/docs/2.4/mod/mod_substitute.html

Best,

Gracias @asanchez75, pero lo

Posted by oskar_calvo on February 26, 2020 at 5:27pm

Gracias @asanchez75, pero lo suyo es informar a Drupal que estas detras de un proxy y que sea Drupal quien lo gestione y no Apache.

Oskar

reverse_proxy_host_header

Posted by jncruces on February 26, 2020 at 5:50pm

Quizás te falte configurar el X_FORWARDED_HOST.. Yo pintaría o depuraría las cabeceras que te llegan y vería en cual te llega el host.

$settings['reverse_proxy_host_header'] = 'X_FORWARDED_HOST';

Saludos.

Gracias, @jncruces , lo miro

Posted by oskar_calvo on March 3, 2020 at 2:48pm

Gracias, @jncruces , lo miro a ver.

Spanish

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /