• 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

Tomcat Http and Https on the same port

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have a web-service endpoint and a http connector on port X. At some point this endpoint needs to switch to https, but on the same port! (I know this is not the normal way of doing things, but this is what my clients expect from an old server they are using...)

Is there a way to do it in tomcat?
 
JavaMonitor Support
Posts: 251
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simply disable the HTTP connector in server.xml and enable the HTTPS connector with the desired port (and set up the keys etc). Note that it is either-or. You can either have HTTP or HTTPS on any one port.
 
Ofri Dagan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I wasn't clear. I need the server to switch to https automatically as a result of some logic.
So I need to disable/enable the connector on run time.
I know I can't serve both http and https on the same, but how can I switch between them on run time?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat binds to the ports when it starts so you would have to restart the server.

This sounds a bit absurd.
Why would your client want to run a site on anything other than the default ports (80 and 443)?
 
Ofri Dagan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it's not a website...
Thanks... I guess I'll have to restart the server.
 
reply
    Bookmark Topic Watch Topic
  • New Topic