Every form action url is in the form action="/http://.....", which makes the system completely unusable.

used software :
apache2
php5.3
drupal-6.19 base installation
ispconfig3

I believe drupal is not to blame (have several sites running on a similar environment), but I can't find where the problem lies. Any help is appreciated!

Kind regards,
Ruben De Baets

Comments

applepie’s picture

Version: 6.19 » 6.20

Hi,

I got exactly the same problem with 6.20

If you have any suggestion to fix the problem I would be happy to hear it.

applepie’s picture

hi,

I narrowed the problem to theme_form($element) in file:form.inc.
The input parameter $element['#action'] has /http://.....

Some other part of the program ( I don't exactly know where) called this function and pass an illegal parameter with the leading slash.

I don't know how to find the root cause but manage to apply a band-aid to theme_form function to get rid of the leading slash that caused the problem.

Here is my fix. Hope it is useful for others. Please let me know if there is a better method.

function theme_form($element) {
// Anonymous div to satisfy XHTML compliance.
if (strncmp($element['#action'],'/http:/',7)==0) // this added to remove unwanted leading slash.
{
$element['#action'] = substr($element['#action'],1);
}
$action = $element['#action'] ? 'action="'. check_url($element['#action']) .'" ' : '';
return '

KC

morgan_jennevret’s picture

I have this same issue in 6.22. I have found the root cause is in bootstrap.inc request_uri() when using Apache server (at least, it's all I have tried).

When a request comes using a full URL such as
GET http://www.example.com/ HTTP/1.0
instead us the expected
GET / HTTP/1.0

That gives the environment variable $_SERVER["REQUEST_URI"] the absolute URL instead of the expected relative-to-root.

function request_uri() {
if (isset($_SERVER['REQUEST_URI'])) {
$uri = $_SERVER['REQUEST_URI'];
}
.......
$uri = '/'. ltrim($uri, '/');
return $uri;
}

Anonymous’s picture

Issue summary: View changes

As a newcomer to Drupal, I was surprised to find such an old post for a problem that I have only recently encountered with both Drupal 6 and Drupal 7 on Windows 7.

I could use the front-end without any trouble, and the back-end administrator pages were fine when used for display only. But when I tried to update any content or config I was presented with a error message similar to "Forbidden You don't have permission to access / on this server". I took this to be a server configuration issue, but I couldn't find one. I also checked database permissions, but nothing awry there.

Then I chose to inspect the code behind the troublesome form, and found the leading slash mentioned by debaetsr. Another search online lead me to this post. From which Capt. Morgan's reference to the bootstrap.inc helped me to find a solution to an irksome problem. And it's quite simple.

Replace

$uri = '/'. ltrim($uri, '/');

by

$uri = preg_replace("/^(\/){1,}/", '/', $uri);

This caters for any number of leading slashes, and works for both relative and absolute paths.

Both Drupal installations on my Windows 7 laptop now work as required. (Windows 7, Apache 2.0.63, PHP 5.3.5, MySQL 5.0.7.)

gaele’s picture