redirect to https

server {
    listen 8080;
    rewrite ^/(.*)$ https://$http_host/ permanent;
}

tcp proxy for e.g. kubernetes

worker_processes  4;

events {
        worker_connections  1024;
}

error_log /dev/stderr;
stream {
    server {
        listen 80;
        proxy_pass 127.0.0.1:30080;
    }
    server {
        listen 443;
        proxy_pass 127.0.0.1:30443;
    }
}