I am running an 'Opensearch Dashboards' server (it's a free fork of Kibana). Opensearch Dashboards runs on port 5601 ('https://myopensearchserver:5601').
I have the below NGINX config that allows me to access the application via 'https://myopensearchserver' and it does a proxy_pass to 'https://myopensearchserver:5601'.
This all works correctly and it has the added benefit that it hides the port number in the browser from the user, just makes it look tidier:
server {
listen 443 ssl;
server_name localhost;
ssl_certificate mycert.pem;
ssl_certificate_key mycert.key;
ssl_client_certificate ca.pem;
location / {
proxy_pass https://myopensearchserver:5601/;
}
}
The problem is that the user could still access 'https://myopensearchserver:5601' in the browser and it completely bypasses my NGINX config. Which is an issue because I plan to build more security controls into my NGINX config.
So I either want to stop the user accessing the application directly via 'https://myopensearchserver:5601', or to somehow redirect it so that it does go via my NGINX config.
How would I do this?