Spring Controller on HTTPS and HTTP

Can I make a controller is available by http and https.

Example:

https://mysite.ru/cart – one controller one page

http://mysite.ru/cart – same controller same page

Answer

Controllers merely process a request and return the response. You may choose to use different controllers to process different URL patters but none of these are in anyway related to the protocol used.

Protocol use would depend how you deploy your server. If you support SSL i.e provide server with valid keystore certificate and password then you will be able to use https protocol in your URLs.

Controllers deal with requests depending on the URL patters that comes after the protocol.

For supporting https URLs you can refer to my blog post on –Supporting https URLs on your server.

Leave a Reply

Your email address will not be published. Required fields are marked *