title: how to config Kong force HTTP to redirect to HTTPS
body: <p>As the kong doc <a href="https://getkong.org/docs/0.13.x/admin-api/#add-certificate" rel="nofollow noreferrer">https://getkong.org/docs/0.13.x/admin-api/#add-certificate</a> , if we want our website to support https, we should do:</p>
  
  <pre><code>curl -i -X POST \
    --url http://localhost:8001/certificates \
    --data 'cert =-----BEGIN CERTIFICATE-----...'
    --data 'key =-----BEGIN RSA PRIVATE KEY-----..'
    --data 'snis =example.com'
  </code></pre>
  
  <p>Now, the website is supporting <code>https</code>, but it's also supporting <code>http</code>.
  How we can force <code>http</code> to redirect to <code>https</code>. </p>
  
  <p>ps: there is a plugin(<a href="https://getkong.org/plugins/dynamic-ssl" rel="nofollow noreferrer">https://getkong.org/plugins/dynamic-ssl</a>). it has a option <code>config.only_https=true</code>. It seems to force to https. But, what's the difference between the <code>dynamic-ssl</code> plugin and the <code>/certificates</code> api.</p>