Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1215648

Summary: Reverse proxy in front of JBoss ON does not render the login page but shows the html source of the page
Product: [JBoss] JBoss Operations Network Reporter: bkramer <bkramer>
Component: UIAssignee: Libor Zoubek <lzoubek>
Status: CLOSED ERRATA QA Contact: Matt Mahoney <mmahoney>
Severity: high Docs Contact:
Priority: unspecified    
Version: JON 3.3.1CC: fbrychta, iweiss, mmahoney, spinder, theute
Target Milestone: ER01Keywords: Triaged
Target Release: JON 3.3.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-30 16:43:24 UTC 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: 1215657    
Bug Blocks:    

Description bkramer 2015-04-27 11:39:59 UTC
Description of problem:
Reverse proxy in front of JBoss ON does not render the login page but shows the html source of the page

Version-Release number of selected component (if applicable):
JBoss ON 3.3.1

How reproducible:
Always

Steps to Reproduce:
1. install and configure JBoss ON 3.3.1
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>
************************************************

Comment 1 Libor Zoubek 2015-05-26 11:55:05 UTC
I was not able to reproduce the issue, my apache did not add any Content-Type header with or without DefaultType in vhost directive.

But from what I read, apache somehow puts DefaultType (in your case global default seems to be text/plain) in case it could not determine the content-type from backend server. Endpoint /coregui/login does not return content-type header at all, which probably causes this bug.

Bellow fix now set's content-type header, I've tested it's returned from http://localhost:7080/coregui/login and through apache proxy.

branch:  master
link:    https://github.com/rhq-project/rhq/commit/a0d5ad940
time:    2015-05-26 13:51:08 +0200
commit:  a0d5ad9401e6d401bf4aa8bcb85e4a77a227cc97
author:  Libor Zoubek - lzoubek
message: Bug 1215648 - Reverse proxy in front of JBoss ON does not render the
         login page but shows the html source of the page

         Always set Content-Type text/html when requesting
         /coregui/login page.

Comment 3 Simeon Pinder 2015-07-10 18:55:36 UTC
Available for test with 3.3.3 ER01 build: 
https://brewweb.devel.redhat.com/buildinfo?buildID=446732
 *Note: jon-server-patch-3.3.0.GA.zip maps to ER01 build of
 jon-server-3.3.0.GA-update-03.zip.

Comment 6 errata-xmlrpc 2015-07-30 16:43:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-1525.html