Problem/Motivation
When Drupal is installed behind a reverse proxy (e.g. http://www.example.com/proxy/ redirecting to http://drupal.example.com/drupal), $base_url
is set to make the URLs correct. However, we observed that the search box (#search-block-form
) is being given an invalid action (/drupal/
, instead of /proxy/
or http://www.example.com/proxy/
).
The cause seems to be in modules/system/system.module
, specifically here (line 297 in version 7.33):
$types['form'] = array( '#method' => 'post', '#action' => request_uri(), '#theme_wrappers' => array('form'), );
request_uri()
generates the invalid code. When replaced by url()
, everything seems to work well. However, I am not experienced enough with Drupal to see any possible repercussions of this change.
Proposed resolution
$types['form'] = array( '#method' => 'post', '#action' => url(), '#theme_wrappers' => array('form'), );
Comments