Redirect http to https


how can I redirect all http connections to https? I’ve done what has been said in this GH issue
but it’s not working!

here is my nginx custom template (just like the original):

worker_processes ${{NGINX_WORKER_PROCESSES}}; # can be set by kong.conf
daemon ${{NGINX_DAEMON}};                     # can be set by kong.conf

pid pids/;                      # this setting is mandatory
error_log logs/error.log ${{LOG_LEVEL}}; # can be set by kong.conf

events {
    use epoll; # custom setting
    multi_accept on;

http {
    # include default Kong Nginx config
    include 'nginx-kong.conf';

    # custom server
    server {
        listen 80 default_server;
        listen [::]:80 default_server;
        server_name _;
        return 301 https://$host$request_uri;

and I ran the following command kong start --nginx-conf /kong-custom.conf but nothing happened.


To share an update and for others who stumble across this, with merged in, Kong 1.2 comes with support for sending HTTPS redirect out of the box in Kong.