Closed Bug 604054 Opened 14 years ago Closed 5 years ago

buglist redirects URL without directory when behind proxy and proxy lacks a directory

Categories

(Bugzilla :: Query/Bug List, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
Bugzilla 6.0

People

(Reporter: john, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 ( .NET CLR 3.5.30729)
Build Identifier: 3.6.2

Bugzilla is set up to have address http://www.riskdecisions.co.uk/r4bugs/
(Apache 2.2 sits here and uses reverse proxy to send those requests to actual server on http://ball:8080/ )

This worked fine for previous versions of bugzilla up to 3.2.3 but I have now upgraded to 3.6.2 and advanced search no longer works.  When you click search in the advanced search page you get sent to http://www.riskdecisions.co.uk/buglist.cgi  (in other words, the /r4bugs/ is missing).  I wonder if this is related to bug 509303

I have a fix - altering the advanced search template so it submits the form using GET not post has sorted it out, but it looks ugly and limits the complexity of searches to use get.

Reproducible: Always

Steps to Reproduce:
1.  Setup Bugzilla 3.6.2 behind a reverse proxy so it is accessed as http://apache2/bugfolder/
2. Go to an advanced search page and click SEARCH
3.
Actual Results:  
You get sent to 
http://apache2/buglist.cgi

Expected Results:  
you should be at
http://apache2/bugfolder/buglist.cgi
Install CGI 3.49, as suggested in bug 509303.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
I'm afraid I have CGI.pm 3.49 and it doesn't help.


D:\Bugzilla\bugzilla>checksetup.pl

D:\Bugzilla\bugzilla>perl checksetup.pl
* This is Bugzilla 3.6.2 on perl 5.10.1
* Running on Win2008 Build 6001 (Service Pack 1)

Checking perl modules...
Checking for              CGI.pm (v3.33)   ok: found v3.49
Checking for          Digest-SHA (any)     ok: found v5.48
Checking for            TimeDate (v2.21)   ok: found v2.24
etc...
So, it looks like you're in the uncommon situation of having a backend where the actual path to your Bugzilla installation is different on the backend server than on the proxy server.

As a workaround, I suspect if your installation becomes ball:8080/r4bugs/, this will start working for you.
Severity: major → minor
Status: RESOLVED → REOPENED
Ever confirmed: true
OS: Windows XP → All
Hardware: x86 → All
Resolution: DUPLICATE → ---
Summary: Advanced search gives the wrong url → buglist redirects URL without directory when behind proxy and proxy lacks a directory
For reference, there's no particularly decent way to resolve this. Redirects must always be full URLs, and we have two ways of building that URL:

  1) Use urlbase. This breaks installations that can be accessed via multiple URLs.

  2) Use the data passed to the webserver to construct a new URL based on the current URL. This is actually great normally, except that when you are in a proxy situation, the webserver itself gets the *backend* URL, and has absolutely no way to know what URL the user typed in.
We could possibly add an advanced parameter, redirects_use_urlbase, for people behind proxies.
I use the urlbase to point to the redirected url and that fails... Has a solution been found? I opened a bug and was redirected here

Leo Lavin
I have just updated a V2.22 installation successfully and all seems to 
work as expected when running as localhost. Prolem is this site is 
redirected for security and ease of use... 

The redirected name is
http://aseweb.meng.lab.emc.com/cust_support/crisis_test/bugjar/ 
and the local name is http://esd-bug-test.meng.lab.emc.com/crisis_bugzilla/ 


The redirection seems to work real fine until I get to an Advanced 
search.. I put in what I want to look for and instead of going to 
http://aseweb.meng.lab.emc.com/cust_support/crisis_test/bugjar/buglis... 
it tries to open 
http://aseweb.meng.lab.emc.com/crisis_bugzilla/buglist.cgi.... I am 
trying to figure out why every other call seems to work except that 
one... 


I really don't want to change sources to make this work. Help Please 

I have retried the steps from release to release... it seems to break with the
v3.3.x releases and on... Works on V3.2.8



Reproducible: Always

Steps to Reproduce:
1.Upgrade 3.2.8 bugzilla release to v3.6.2 using tarball
2.Go to search page,,, go to advanced search and select search
3.If successfull out put shows up. If not page gets 404 error as the
redirection is going to a non-existent page as the url base is incorrect.
Actual Results:  
404 error. Page set is incorrect as redirection is point to non-existent url

Expected Results:  
See list of open bugs

I cannot upgrade my version of Bugzilla past V3.2.8 because of this!
I really need a resolution for this... I am stuck!

Please
Bugzilla seems to use cgi-virtual_host for redirection, and in lib/CGI.pm
#### Method: virtual_host
# Return the name of the virtual_host, which
# is not always the same as the server
######
'virtual_host' => <<'END_OF_FUNC',
sub virtual_host {
    my $vh = http('x_forwarded_host') || http('host') || server_name();
    $vh =~ s/:\d+$//;		# get rid of port number
    return $vh;
}
END_OF_FUNC

The virtual host is taken from X-Forwarded-Host header, if you unset this header in your web server, for example Apache putting "RequestHeader unset X-Forwarded-Host" in your httpd.conf then it should use the correct host in the redirect and the proxy then notices this.

But I think this is only a temporary fix, and X-Forwarded-Host should not be used in this situation. Also X-Forwarded-Host can contain multiple entries.
Got the same issue with Bugzilla 5.0.3.

Configuration:
https://frontserver/bugzilla ProxyPass (Apache) to http://mybugzillaserver/ (container...) with "frontserver" as apache ServerName
Buzilla is configured with urlbase and sslbase point to https://frontserver/bugzilla.

Bugzilla "works" but all but all buglist.cgi queries redirect to http://frontserver/buglist.cgi !

My workaround:
- Add alias in bugzilla server: https://frontserver/bugzilla proxying http://mybugzillaserver/bugzilla
- Have to OPEN port 80 and redirect http queries to https (using Apache Redirect)

But openning a port (ONLY for this issue !) have a significant impact on infrastructure and security.
Did you try it with

proxy_redirect http:// $scheme://;

Below your proxy_pass directive?
Issue is partially resolved toggling ProxyPreserveHost to Off (lecagy configuration) and not configuring backend ServerName with the same as frontend.
Now this configuration works:
https://frontserver/bugzilla/ ProxyPass (Apache) to http://mybugzillaserver/bugzilla/

However I needs to declare an alias bugzilla on backend server.
Configuration https://frontserver/bugzilla/ ProxyPass (Apache) to http://mybugzillaserver/ still fail for buglist.cgi calls.

I guess this has been solved in Bug 1503483.

Status: REOPENED → RESOLVED
Closed: 14 years ago5 years ago
Depends on: 1503483
Resolution: --- → FIXED
Target Milestone: --- → Bugzilla 6.0
You need to log in before you can comment on or make changes to this bug.