elvirt
elvirt

Reputation: 111

Tomcat 8 IP to domai name

I'm using tomcat 8 on Windows server 2016. I have configured SSL and now I want to redirect users from IP to domain name. So for example if you enter Domain Name Server: 31.13.69.228 you will be redirected to facebook.com. I have tried different things like, adding in server.xml:

<Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />

and created a file under /conf/Catalina/localhost rewrite.config with following entry

RewriteCond %{HTTP_HOST} ^111\.111\.111\.111$ [NC]
RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ sub.domain.com/$1 [R=301,L]

where 111.111.111.111 represents my ip and sub.domain.com represents a domain to which i want to redirect user.

Upvotes: 0

Views: 888

Answers (1)

Michael-O
Michael-O

Reputation: 18415

Tomcat committer here...

This is pure non-sense. The Domain Name System (DNS) has been developed for humans not to memorize IP addresses. There is no need to tell the user the IP address. In fact, you are creating issues like IP address changes, DNS load balancing, etc. No serious server/application operates on pure IP addresses.

Upvotes: 1

Related Questions