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

Version: 7.33 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.