title: Block third party HTTPS referers in Nginx
body: <p>I've a mp3 download site. Some websites are using my site's feed, that's why I am loosing my limited Bandwidth.</p>
  
  <p>I've used the following code to restrict access to my mp3 files from third-party referers.</p>
  
  <pre><code>valid_referers none blocked server_names *.example.com;
  if ($invalid_referer) {
      return   403;
  }
  </code></pre>
  
  <p>This works well for <strong>HTTP</strong> sites (e.g. <a href="http://www.example.com" rel="nofollow noreferrer">http://www.example.com</a>), but doesn't work at all with <strong>HTTPS</strong> sites (e.g. <a href="https://example.blogspot.com" rel="nofollow noreferrer">https://example.blogspot.com</a>). Why is that and how can I block those?</p>