• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to redirect Tomcat servlet request gracefully

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

I have used Tomcat in several projects, using both SSL and non-SSL connectors. I have a problem that I hope someone could help.

Say I have a servlet with context at "/management". It has 2 connectors, a non-SSL on port 8080 and a SSL on port 8443. All works fine, i.e. I can get to it either using "https://localhost:8443/management" or "http://localhost:8080/management".

My problem is that, say, a user happens to type in a wrong protocol to a wrong port, i.e. "https://localhost:8080/management" or "http://localhost:8443/management".
In the first case, the browser (IE) would eventually display "Internet Explorer cannot display the webpage", which is expected.
In the latter case, the browser displays a blank page with 5 small squares, like " "... making it very confusing to the user.

Do you guys know how to handle this more gracefully? I looked into Tomcat source and it tries to to ssl-handshake for the HTTP messaging coming in. Of course that fails, so it will close the connection. Those are all fine, but how come the browser does not display "Internet Explorer cannot display the webpage" like the other case?
Another option would be, somehow forwarding "http://localhost:8443/management" to "https://localhost:8443/management"... How?

Thank for you suggestions and help.
Henry

BTW, I think this happens to early so writing a Filter doesn't help. Using <security-constraint> in web.xml is not an option either because we must be able to handle both HTTP and HTTPS for the same resource, just different ports.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need solution also. http://IP-Host:8443/any-char will give a blank page like " ".
 
If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic