From http to https

I have a simple web application: a web page with a form to submit and a server side servlet.

It works.

Now I will be asked to change it so that the form address changes from
http://www.example.com/myForm.html at https://www.example.com/myForm.html

What are the steps for doing this? Do I need to change the servlet? My deployment? My webpage? All of them?

Thanks.

+4
source share
4 answers

Just a deployment, not your servlet. It is a matter of setting up your web server to use HTTPS (HTTP over SSL), not HTTP (cleartext HTTP) to serve the page.

This configuration change should not affect your servlet at all if your servlet does not have absolute (but not relative) references to itself, but you still will not do it. :-)

Read more about HTTPS here. The configuration information will depend on the web server used.

+4
source

The servlet container must be configured to deliver the content in encrypted form. Here's how to do it on Tomcat . If you are using a different servlet container, add this information to your question.

+2
source

It is simply a change in the way the client and server interact over the network with each other. This is a server configuration issue. Just configure the server to use HTTPS. No changes to the logic / code stream are required, you only need to update any absolute URL in your webapp accordingly (in HTML links, form actions, etc.). Therefore, if your form action, for example, http://www.example.com/myForm.html instead of myForm.html , and the open page does not open HTTPS, you need to change the form action to the HTTPS URL.

As for the server configuration, it is not clear which server you are using, so here is an example of Tomcat that is designed to configure the server to use HTTPS (SSL): http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto. html Any self-respecting server sends this information.

+1
source
  • Get the server certificate. This can be either a self-signed certificate or a certificate issued by a trusted issuer.
  • Configure the servlet container to accept https connections (on tomcat - through a special <Connector> )
+1
source

Source: https://habr.com/ru/post/1307464/


All Articles