Nginx for OpenSearch UI
Copy
cat /etc/nginx/conf.d/opensearch-prod.conf
server {
listen 443 ssl;
server_name oss.ahmadraza.in;
# This Self-Signed Certificate is required
ssl_certificate /etc/nginx/ssl/oss.ahmadraza.in.crt;
ssl_certificate_key /etc/nginx/ssl/oss.ahmadraza.in.key;
# --- CRITICAL FIX FOR "INVALID COOKIE" ---
# OpenSearch cookies are huge. You MUST increase these buffers.
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
client_max_body_size 50M;
# -----------------------------------------
# Redirect root "/" to the Dashboards URL
location = / {
return 302 /_dashboards/;
}
location / {
proxy_pass https://vpc-ahmadraza-oss.ap-south-1.es.amazonaws.com;
# Use $host so Dashboards knows your public URL
proxy_set_header Host $host;
# Standard forwarding headers
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Explicitly tell Dashboards we are using HTTPS
proxy_set_header X-Forwarded-Proto https;
# SSL handling for the backend connection
proxy_ssl_server_name on;
proxy_ssl_session_reuse off;
}
}
# Optional: Redirect HTTP (80) to HTTPS (443)
server {
listen 80;
server_name oss.ahmadraza.in;
return 301 https://$host$request_uri;
}
