Bug 1215657

Summary: Reverse proxy in front of RHQ does not render the login page but shows the html source of the page
Product: [Other] RHQ Project Reporter: bkramer <bkramer>
Component: Core UIAssignee: Nobody <nobody>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.12CC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1215648    

Description bkramer 2015-04-27 11:47:07 UTC
Description of problem:

Reverse proxy in front of RHQ does not render the login page but shows the html source of the page

Version-Release number of selected component (if applicable):
RHQ 4.12

How reproducible:
Always

Steps to Reproduce:
1. install and configure RHQ 4.12
2. install Apache httpd server and configure virtual host in the httpd.conf file:
******************************
<VirtualHost jon.server.example:80>

ServerName jon.server.example

ProxyRequests Off
ProxyPreserveHost On

ProxyPass        /  http://jon.server.example:7080/
ProxyPassReverse /  http://jon.server.example:7080/

</VirtualHost>
******************************
3. restart the Apache server;
4. navigate to http://jon.server.example/coregui/login

Actual results:
Browser will present the source of the page


Expected results:
Browser properly renders the login page and we have login username/password fields presented.

Additional info:
For some reason, when going through reverse proxy, response Content-Type is set to "text/plain" instead of expected "text/html". 

If we run wget command the following is got:

************************************************
# wget -v -d http://jon.server.example/coregui/login
DEBUG output created by Wget 1.12 on linux-gnu.

--2015-04-27 11:37:31--  http://jon.server.example/coregui/login
Resolving jon.server.example... 10.33.1.53
Caching jon.server.example => 10.33.1.53
Connecting to jon.server.example|10.33.1.53|:80... connected.
Created socket 3.
Releasing 0x00000000015387e0 (new refcount 1).

---request begin---
GET /coregui/login HTTP/1.0
User-Agent: Wget/1.12 (linux-gnu)
Accept: */*
Host: jon.server.example
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response... 
---response begin---
HTTP/1.1 200 OK
Date: Mon, 27 Apr 2015 10:37:31 GMT
Server: Apache-Coyote/1.1
Accept-Ranges: bytes
ETag: W/"5265-1423819844000"
Last-Modified: Fri, 13 Feb 2015 09:30:44 GMT
Content-Length: 5265
Connection: close
Content-Type: text/plain; charset=UTF-8

---response end---
200 OK
Length: 5265 (5.1K) [text/plain]
Saving to: `login'

100%[====================================================================================================================================================================================================>] 5,265       --.-K/s   in 0s      

Closed fd 3
2015-04-27 11:37:31 (278 MB/s) - `login' saved [5265/5265]
************************************************


However, setting DefaultType to text/html for virtual host [1] seems to make a difference as wget command will return:

************************************************
# wget -v -d http://jon.server.example/coregui/login
DEBUG output created by Wget 1.12 on linux-gnu.

--2015-04-27 11:43:58--  http://jon.server.example/coregui/login
Resolving jon.server.example... 10.33.1.53
Caching jon.server.example => 10.33.1.53
Connecting to jon.server.example|10.33.1.53|:80... connected.
Created socket 3.
Releasing 0x00000000020dc700 (new refcount 1).

---request begin---
GET /coregui/login HTTP/1.0
User-Agent: Wget/1.12 (linux-gnu)
Accept: */*
Host: jon.server.example
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response... 
---response begin---
HTTP/1.1 200 OK
Date: Mon, 27 Apr 2015 10:43:58 GMT
Server: Apache-Coyote/1.1
Accept-Ranges: bytes
ETag: W/"5265-1423819844000"
Last-Modified: Fri, 13 Feb 2015 09:30:44 GMT
Content-Length: 5265
Connection: close
Content-Type: text/html; charset=UTF-8

---response end---
200 OK
Length: 5265 (5.1K) [text/html]
Saving to: `login.1'

100%[====================================================================================================================================================================================================>] 5,265       --.-K/s   in 0s      

Closed fd 3
2015-04-27 11:43:58 (203 MB/s) - `login.1' saved [5265/5265]
************************************************



[1] New configuration for virtual host:
************************************************
<VirtualHost jon.server.example:80>

ServerName jon.server.example

ProxyRequests Off
ProxyPreserveHost On

DefaultType text/html

ProxyPass        /  http://jon.server.example:7080/
ProxyPassReverse /  http://jon.server.example:7080/

</VirtualHost>
************************************************