sgargel
sgargel

Reputation: 1046

Apache rewrite or susbstitute rule for bugzilla HTTP 301 redirect

I'm trying to reverse proxy a bugzilla 4.2.3 site using Apache 2.4.

Bugzilla is on HTTP and I have no access to configuration.

This is my Apache config:

<VirtualHost bug.mydomain.com:443>
        SSLEngine on
        SSLCertificateFile /etc/pki/tls/certs/mydomain.crt
        SSLCertificateKeyFile /etc/pki/tls/private/mydomain.key
        ServerAdmin [email protected]
        ServerName bug.mydomain.com

        RequestHeader unset Accept-Encoding
        ProxyPass "/" "http://192.168.x.x/bugzilla/"
        ProxyPassReverse "/" "http://192.168.x.x/bugzilla/"
        AddOutputFilterByType SUBSTITUTE text/html
        Substitute "s|http://192.168.x.x/bugzilla/|https://bug.mydomain.com/|i"
</VirtualHost>

href are successfully updated by Apache but bugzilla make internal usage of HTTP 30x redirects and those are not substituted by my rules.

This is my request:

GET https://bug.mydomain.com/buglist.cgi?resolution=---&emailassigned_to1=1&emailreporter1=1&emailtype1=exact&email1=[...]

This is the reply:

HTTP 302 http://bug.mydomain.com/bugzilla/buglist.cgi?resolution=---&emailassigned_to1=1&emailreporter1=1&emailtype1=exact&email1=[...]

Is it possible to rewrite also those redirects ?

Upvotes: 1

Views: 147

Answers (1)

sgargel
sgargel

Reputation: 1046

The only workaround I found is adding a HTTP virtualhost:

<VirtualHost bug.mydomain.com:80>
        ServerAdmin [email protected]
        Redirect permanent /bugzilla/ https://bug.mydomain.com/
        ServerName bug.mydomain.com
</VirtualHost>

Upvotes: 1

Related Questions