title: Trying to prevent direct IP access Nginx SSL
body: <p>I've been searching for the answer here regarding the following code:</p>
  
  <pre><code>server {
     listen 443 ssl;
     server_name "host.domain.com";
  
     location / {
              proxy_pass http://host.domain.com;
  
              }
  
      ssl_certificate      /etc/httpd/ssl/Sample_StarCert.crt;
      ssl_certificate_key  /etc/httpd/ssl/Sample-NPW.key;
  
      }
  </code></pre>
  
  <p>This does what it's supposed to do for the most part by reverse-proxying SSL requests to an http server on the same machine for host.domain.com requests (by design).</p>
  
  <p>The problem arises when I try to access the same site <a href="https://ipaddress" rel="nofollow noreferrer">https://ipaddress</a></p>
  
  <p>Now the browser accessing the site in this manner is confronted with a certificate warning.  I need that certificate warning to go away under these circumstances and to either get that attempt blocked, or redirected to a FQDN request.  Either is fine.</p>
  
  <p>I've been trying to accomplish this with other server blocks, but the problem I keep running into is that SSL server blocks seem to really want to begin presenting the certificate to the browser before processing the request which is strange to me since I thought SNI (which this server is compiled with) is designed to recognize the request before presenting a certificate is necessary?  It's very likely I just misunderstand how this all works and would welcome the guidance.</p>
  
  <p>I tried conditional statements with no success as well.  Any ideas?</p>