I have a situation where I need to listen for http and https on same port(8099) and serve the same content to both http and https requests. My config file for https is given below. I have tried adding listen 8099; to the server block but thats not helping.
worker_processes auto;
events {
worker_connections 4096;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
proxy_connect_timeout 3200s;
proxy_read_timeout 3000s;
#gzip on;
server {
listen 8099 ssl http2;
ssl on;
ssl_certificate C:/cert/letsencrypt.crt;
ssl_certificate_key C:/cert/letsencrypt-decrypted.key;
#ssl_protocols TLSv1.2;
ssl_buffer_size 4k;
ssl_session_tickets off;
ssl_session_cache shared:SSL:5m;
ssl_session_timeout 60m;
access_log off;
location / {
try_files $uri $uri/ /index.html;
}
location /ort/{
proxy_pass http://localhost:8042;
proxy_set_header Authorization "Basic YWxuYXNnjiiBhY3M6YWxuYXNhcnBhY3M1Nzc=";
proxy_set_header HOST $Host:8099/ort/;
proxy_set_header X-Real-IP $remote_addr;
rewrite /ort(.*) $1 break;
}
}}