#41661 closed defect (bug) (duplicate)
Using proxy & HTTP 1.1 leads to full URL in REQUEST_URI variable in Apache
Reported by: | olygraph | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
When using a proxy the browser send a full URL in var REQUEST_URI
$_SERVER['REQUEST_URI'];
i.e.:
With proxy: it returns http://mydomain.com/requestedurl
No Proxy: it returns /requestedurl
Solution:
check the variable to see if it is full path and transform it:
<?php $_SERVER['REQUEST_URI'] = requesturl_format($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']); function requesturl_format($m_host, $m_request){ $m_regex = sprintf('#(https?://)(%s)(/.*)#', $m_host); if(preg_match( $m_regex, $m_request, $matches)){ if(count($matches) == 4){ $m_host = ($matches[1]); $m_domain = ($matches[2]); $m_url_req = ($matches[3]); return $m_url_req; } } return $m_request; }
Change History (3)
Note: See
TracTickets for help on using
tickets.
Hey there,
Thanks for your report and welcome to Trac. This sounds like a duplicate of #17047. Can you confirm this?