14 Replies Latest reply on Dec 19, 2013 5:42 PM by ehle

    html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)

    ehle

      Hello,

       

      I got hopefully a stupid one that one of you can tell me to RTFM on   and then be so kind as to point me at that part of documentation since I haven't found it yet.

       

      So I have tomcat7 and mod_cluster set up to work together, and over all things are working.. except that instead of rendering an index.html, it is getting displayed to the screen... When its used as a welcome file.

       

      put this in to my browser:

      http://myapp.mycompany.com/index.html

       

      And I get the front page/sign on for the app. (that it is explicitly index.html thing may be a red herring - it might just be an oddity of tomcat7 welcome file handling)

       

      I put http://myapp.mycompany.com  in as the URL and I get this:

      <!DOCTYPE html> <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]--> <!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]--> <!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]--> <!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->    <!-- 508 -->   <head> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="expires" content="0"> <meta HTTP-EQUIV="content-type" CONTENT="text/html;charset=utf-8"> <meta charset="utf-8" /> <meta name="description" content="" /> <meta name="author" content="JAMF Software" /> <meta name="apple-mobile-web-app-title" content="JSS"> <meta name="version" content="9.12"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <title>JSS Login - JSS v9.12</title> <link href="stylesheets/reset.css" rel="stylesheet" /> <link href="stylesheets/styles.css?v=1" rel="stylesheet" /> <script type="text/javascript" src="javascripts/jquery/jquery.js"></script> <script type="text/javascript" src="javascripts/scripts.js"></script> <script type="text/javascript" src="javascripts/jquery.tablesorter.min.js"></script>   <!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: --> <link rel="apple-touch-icon-precomposed" href="images/touchicons/apple-touch-icon-precomposed.png"> <!-- For first- and second-generation iPad: --> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/touchicons/apple-touch-icon-72x72-precomposed.png"> <!-- For iPhone with high-resolution Retina display: --> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="images/touchicons/apple-touch-icon-114x114-precomposed.png"> <!-- For third-generation iPad with high-resolution Retina display: --> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/touchicons/apple-touch-icon-144x144-precomposed.png">   <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head>   <body> <div id="login-wrapper"> <form method="POST" name="f"> <div id="login-panel"> <span class="label">Username</span> <input name="username" id="username" class="input" value="" autocapitalize="off" autocorrect="off"/>  <span class="label">Password</span> <input name="password" id="password" class="input" type="password" autocomplete="off" />  <input type="submit" class="button" value="Log In" />  </div> </form> </div> </body>  <script> function setDefaultField(){  document.f.username.focus();  } </script> 

      better formatted though

      I THINK it is probably the output of  ./WEB-INF/frontend/login.jsp

       

      The app is the only app that will be running on this tomcat instance, and per vendor instruction, its installed in the ROOT context.

       

      I think its something mod_cluster related (and come here) because when I go to http:myapp.mycompany.com:8080/ it shows up  just fine.

       

      Anyone have a thought they care to share?

       

      Thanks!

       

      David.

        • 1. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
          jfclere

          first http://myapp.mycompany.com != http://myapp.mycompany.com/

          I think you probably get a redirect from http://myapp.mycompany.com to http://myapp.mycompany.com/ or to the welcome page of the webapp.

          curl -v http://myapp.mycompany.com should redirect you correctly to the webapp.

          It is weird to see that you get text/plain instead text/html, could you check the headers using curl?

          1 of 1 people found this helpful
          • 2. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
            rhusar

            Hm, if the content type set by the server and not overidden in the apache config then accessing the page directly on tomcat via http connector (:8080) should output the same result -- does it?

            1 of 1 people found this helpful
            • 3. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
              ehle

              Jean-Frederic, Radoslave,

               

              Thank you both for your replies.

               

              I think you are right and it boils down to when entering a url that ends in a .html  file (index.html was red herring. foo.html, bar.html give same behavior), I get:

              Content-Type: text/html; charset=UTF

               

              vs

               

              When I ask for http://myapp.mycompany.com with or without a trailing slash, I get

              Content-Type: text/plain; charset=UTF

               

               

              Here is the output of: curl -kv https://casper-dev0.it.anl.gov/

              * About to connect() to myapp.mycompany.com port 443 (#0)

              *   Trying ###.###.###.###...   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                               Dload  Upload   Total   Spent    Left  Speed

                0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0connected

              * successfully set certificate verify locations:

              *   CAfile: none

                CApath: /etc/ssl/certs

              * SSLv3, TLS handshake, Client hello (1):

              } [data not shown]

              * SSLv3, TLS handshake, Server hello (2):

              { [data not shown]

              * SSLv3, TLS handshake, CERT (11):

              { [data not shown]

              * SSLv3, TLS handshake, Server key exchange (12):

              { [data not shown]

              * SSLv3, TLS handshake, Server finished (14):

              { [data not shown]

              * SSLv3, TLS handshake, Client key exchange (16):

              } [data not shown]

              * SSLv3, TLS change cipher, Client hello (1):

              } [data not shown]

              * SSLv3, TLS handshake, Finished (20):

              } [data not shown]

              * SSLv3, TLS change cipher, Client hello (1):

              { [data not shown]

              * SSLv3, TLS handshake, Finished (20):

              { [data not shown]

              * SSL connection using DHE-RSA-AES128-SHA

              * Server certificate:

              * subject: C=--; ST=SomeState; L=SomeCity; O=SomeOrganization; OU=SomeOrganizationalUnit; CN=myapp.mycompany.com; emailAddress=root@myapp.mycompany.com

              * start date: 2013-10-18 21:32:22 GMT

              * expire date: 2014-10-18 21:32:22 GMT

              * common name: myapp.mycompany.com (matched)

              * issuer: C=--; ST=SomeState; L=SomeCity; O=SomeOrganization; OU=SomeOrganizationalUnit; CN=myapp.mycompany.com; emailAddress=root@myapp.mycompany.com

              * SSL certificate verify result: self signed certificate (18), continuing anyway.

              > GET / HTTP/1.1

              > User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3

              > Host: myapp.mycompany.com

              > Accept: */*

              >

              < HTTP/1.1 401 Unauthorized

              < Date: Wed, 20 Nov 2013 15:43:56 GMT

              < X-FRAME-OPTIONS: SAMEORIGIN

              < Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0

              < Set-Cookie: JSESSIONID=844C12707906BA2FD427D9A3D9922786.myapp.mycompany.com; Path=/; Secure; HttpOnly

              < Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0

              < Content-Length: 2675

              < Connection: close

              < Content-Type: text/plain; charset=UTF-8

              <

              { [data not shown]

              100  2675  100  2675    0     0  73468      0 --:--:-- --:--:-- --:--:-- 95535

              * Closing connection #0

              * SSLv3, TLS alert, Client hello (1):

              } [data not shown]

              !-- 508 -->en" class="no-js"> <!--<![endif]--> ie9"> <![endif]-->

               

               

              </body>f</div>d=</form>e</div>d=<input type="submit" class="button" value="Log In" />pe="password" autocomplete="off" />rect="off"/>

              </script>ocument.f.username.focus();

               

              VS

               

              curl -kv https://casper-dev0.it.anl.gov/foo.html

              * About to connect() to myapp.mycompany.com port 443 (#0)

              *   Trying ###.###.###.###...   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                               Dload  Upload   Total   Spent    Left  Speed

                0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0connected

              * successfully set certificate verify locations:

              *   CAfile: none

                CApath: /etc/ssl/certs

              * SSLv3, TLS handshake, Client hello (1):

              } [data not shown]

              * SSLv3, TLS handshake, Server hello (2):

              { [data not shown]

              * SSLv3, TLS handshake, CERT (11):

              { [data not shown]

              * SSLv3, TLS handshake, Server key exchange (12):

              { [data not shown]

              * SSLv3, TLS handshake, Server finished (14):

              { [data not shown]

              * SSLv3, TLS handshake, Client key exchange (16):

              } [data not shown]

              * SSLv3, TLS change cipher, Client hello (1):

              } [data not shown]

              * SSLv3, TLS handshake, Finished (20):

              } [data not shown]

              * SSLv3, TLS change cipher, Client hello (1):

              { [data not shown]

              * SSLv3, TLS handshake, Finished (20):

              { [data not shown]

              * SSL connection using DHE-RSA-AES128-SHA

              * Server certificate:

              * subject: C=--; ST=SomeState; L=SomeCity; O=SomeOrganization; OU=SomeOrganizationalUnit; CN=myapp.mycompany.com; emailAddress=root@myapp.mycompany.com

              * start date: 2013-10-18 21:32:22 GMT

              * expire date: 2014-10-18 21:32:22 GMT

              * common name: myapp.mycompany.com (matched)

              * issuer: C=--; ST=SomeState; L=SomeCity; O=SomeOrganization; OU=SomeOrganizationalUnit; CN=myapp.mycompany.com; emailAddress=root@myapp.mycompany.com

              * SSL certificate verify result: self signed certificate (18), continuing anyway.

              > GET /foo.html HTTP/1.1

              > User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3

              > Host: myapp.mycompany.com

              > Accept: */*

              >

              < HTTP/1.1 401 Unauthorized

              < Date: Wed, 20 Nov 2013 15:43:40 GMT

              < X-FRAME-OPTIONS: SAMEORIGIN

              < Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0

              < Set-Cookie: JSESSIONID=3DF21F7D01D397035A6ADD485E82DF1C.myapp.mycompany.com; Path=/; Secure; HttpOnly

              < Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0

              < Content-Length: 2675

              < Connection: close

              < Content-Type: text/html; charset=UTF-8

              <

              { [data not shown]

              100  2675  100  2675    0     0  50090      0 --:--:-- --:--:-- --:--:-- 60795

              * Closing connection #0

              * SSLv3, TLS alert, Client hello (1):

              } [data not shown]

              !-- 508 -->en" class="no-js"> <!--<![endif]--> ie9"> <![endif]-->

               

               

              </body>f</div>d=</form>e</div>d=<input type="submit" class="button" value="Log In" />pe="password" autocomplete="off" />rect="off"/>

              </script>ocument.f.username.focus();

               

               

              Any other thoughts?  I've tried adding index.jsp to the DirectoryIndex list in httpd.conf but it didn't seem to make a difference.

               

              Thanks!!

              David.

              • 4. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
                ehle

                Radoslav Husar said:

                Hm, if the content type set by the server and not overidden in the apache config then accessing the page directly on tomcat via http connector (:8080) should output the same result -- does it?


                Going straight to http://myapp.mycompany.com:8080/ or http://myapp.mycompany.com:8080 works as expected - the login page displays.  It says text/html instead of text/plain.


                Any thoughts on why it doesn't work when it goes through mod_cluster?  I really don't want to expose this thing directly. 

                 

                Thanks!

                 

                (Edited to clarify that I was responding to Radoslav's question, not saying I had a workaround)

                • 5. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
                  jfclere

                  you get a 401 where I would expect a redirect, weird. How is the authentication excepted to work?

                  • 6. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
                    ehle

                    Jean-Frederic,

                     

                    The "front page" is supposed to be a login page if you have authenticated (looks like auth status is stored in cookie)

                     

                    If your authenticated, then it goes to the app dashboard.

                     

                    When accessing the site via lynx, I do get the "Show the 401 message body? (y/n)" question,  and it doesn't seem to store my auth status.  Accessing via another browser, I skip the login screen once I've authenticated until I log out or session expires.

                     

                    It is just authenticating against app internal accounts (probably stored in a mysql DB backend), though it has the option to use a LDAP/AD backend.

                     

                    Right now I am doing a little workaround by moving the app off the root context, and reating a index.html that redirects to /casper/index.html. That seems to satisfy trigger whatever it is that needs a .html extension to pass back text/html rather than text/plain. Replacing the existing index.html doesn't work - the replacement is ignored just like original unless application is unconfigured (no DB backend set etc)

                     

                    Sorry about the slow reply... holidays and other work intervened for a bit.

                    • 7. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
                      jfclere

                      What does a direct connect to http://myapp.mycompany.com do?

                      That should be a redirect to the login page no?

                      What is secured in the webapp?

                      • 8. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
                        ehle

                        Jean-Frederic,

                         

                        Just connecting to  http://myapp.mycompany.com (no port specified, routed through mod_cluster to tomcat ROOT context) when the app is installed under ROOT, first gives the "lets finish configuring" page, and then after you have done that and its "ready" thereafter displays the "code" that I pasted up at the top. Its not rendered.

                         

                        Our current workaround is to move the app from ROOT to <appname> and then put an index.html in the ROOT context that just redirects to http://myapp.mycompany.com/appname/index.html which provokes an app login interface (username password)

                         

                        David.

                        • 9. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
                          jfclere

                          try http://httpd.apache.org/docs/2.2/mod/core.html#defaulttype

                          DefaultType text/html

                           

                          If that works it means that for some reasons the content-type isn't provided to httpd.

                          • 10. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
                            rhusar

                            BTW There was similar problem in WFly, but it got fixed but I am not sure how [UNDERTOW-19] Enforced 'Content-Type: text/plain' for proxied requests via mod_proxy_http - JBoss Issue Tracker.

                            • 11. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
                              jfclere

                              Yep it is the same kind of issue that Content-Type is missing in the back-end and a default value is added by the proxy...

                              • 12. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
                                ehle

                                Jean-Frederick, Radoslav,

                                 

                                I tried adding DefaultType text/html to a file included by my httpd.conf, but after restarting httpd I didn't see any change in behavior.

                                 

                                Any other ideas?

                                 

                                David.

                                • 13. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
                                  rhusar

                                  http://httpd.apache.org/docs/current/mod/core.html#defaulttype

                                   

                                  This directive has no effect other than to emit warnings if the value is not none. In prior versions, DefaultType would specify a default media type to assign to response content for which no other media type configuration could be found.

                                  Looks like this has no effect anymore since 2.2.7, which version you are running?

                                   

                                  Can you give us something so we can reproduce this locally?

                                  • 14. Re: html(?) not rendered when going through mod_cluster? (Tomcat7 + mod_cluster)
                                    ehle

                                    Radoslav,

                                     

                                    Yep, a EWS/RH version  of Apache that is significantly later than that. Good catch.

                                     

                                    The application is proprietary, so I'm not sure on its inner workings...  

                                     

                                    WEB-INF/web.xml  has this...

                                    # lots of <servlet>

                                    # few mappings, then

                                      <servlet-mapping>

                                        <servlet-name>FrontEndController</servlet-name>

                                        <url-pattern>*.html</url-pattern>

                                      </servlet-mapping>

                                    # more mappings

                                    # some filters

                                      <filter-mapping>

                                        <filter-name>LoadingFilter</filter-name>

                                        <url-pattern>/*</url-pattern>

                                      </filter-mapping>

                                    # more filters

                                      <filter>

                                        <filter-name>AccessFilter-Computer</filter-name>

                                        <filter-class>com.propritary.sw.frontend.JSSAccessFilter</filter-class>

                                        <init-param>

                                          <param-name>AccessMode</param-name>

                                          <param-value>Computer Management Only</param-value>

                                        </init-param>

                                      </filter>

                                    # etc.

                                     

                                    Sorry I can't be more specific, I'd need to see if we have a policy about putting info about apps being used in public