I want every URL coming into my Tomcat web server to carry the www
subdomain prefix.
How can I have Tomcat alter an incoming URL such as this:
http://Example.com/whatever
…to include the www
subdomain prefix:
http://www.Example.com/whatever
The goal is that my Java Servlets receive URLs that always carry the www
prefix.
I have been told that DNS is not the place to do this. Supposedly, the web server is the proper place to adjust from bare domain to subdomain.
Is URL redirection what I need? If so, how do I configure Tomcat for that?
If I was doing this I would do it in something like nginx that I would be using to handle redirects like this and probably to force https as well.
The following nginx config should do what you want.