Opened 4 years ago

Closed 4 years ago

#1451 closed Bug (fixed)

Apache+Rails: malformed REQUEST_URI

Reported by: shopmaker Owned by: vipsoft
Priority: low Milestone: Piwik 0.6.4
Component: Core Keywords:
Cc: Sensitive: no

Description

hello, i am experiencing some errors with the "Form security key" stuff when i want to login to piwik on my machine. I tracked down the error to the function "static public function getCurrentScriptName()" in Url.php

The $_SERVER\['REQUEST_URI'\] on my machine is not set correctly. instead of just /path/to/piwik/index.php it is set to http://www.some_host_i_am_using.com.local/path/to/piwik/index.php

i am not sure why this is the way it is so i just give you some hints:
i am on ubuntu lucid, with apache and php installed from repository.
piwik version is 0.6.3 but i also experienced this with earlier versions.
my virtual hosts file is not really interesting:

<VirtualHost *:80>
  ServerName www.some_host_i_am_using.com.local
  DocumentRoot /path/to/some/app/public
  RailsEnv development
</VirtualHost>

as you can see i am running a ruby on rails project. piwik is located in the public directory.

what is strange here: if i create a phpinfo file and call it via http://localhost/piwik/info.php the REQUEST_URI is set to "/piwik/info.php", when i call it via http://www.some_host_i_am_using.com.local/piwik/info.php i get REQUEST_URI set to "http://www.some_host_i_am_using.com.local/piwik/info.php"

i know this is not really a piwik related bug, but you could work around it :) my quickfix is to comment out the else if in Url.php where you try to check the REQUEST_URI (line 94). SCRIPT_NAME is set correct here and i am using this now.

Change History (5)

comment:1 Changed 4 years ago by vipsoft (robocoder)

  • Keywords REQUEST_URI Form security key getCurrentScriptName removed
  • Milestone set to 0 - Piwik 0.6.4
  • Owner set to vipsoft

I'll look into this, since I run Lucid on my dev box and haven't encountered this problem.

comment:2 Changed 4 years ago by vipsoft (robocoder)

This appears to be a web server misconfiguration. Check your RewriteRules -- for example, make sure you don't have something like:

RewriteRule (.*) http://www.some_host_i_am_using.com.local/%{REQUEST_URI}

comment:3 Changed 4 years ago by vipsoft (robocoder)

  • Summary changed from Error: Form security key is invalid or has expired. Please reload the form and check that your cookies are enabled. to Apache+Rails: malformed REQUEST_URI

comment:4 Changed 4 years ago by vipsoft (robocoder)

  • Priority changed from major to low

comment:5 Changed 4 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from new to closed

(In [2389]) fixes #1451

Note: See TracTickets for help on using tickets.