I think since Nginx is a web server, you’ll still have to provide it a DocumentRoot inside of a server{} directive. Since you have no code to serve up and are only acting as a proxy, I believe the document root can be arbitrary as long as you’re including the proxy_pass directive.
I haven’t done this in a while, but I believe there’s some magic you can perform by using the nginx_http_proxy module as well - you can read all about it at
The thing is that we are using apache currently in our environment. By any chance do you have any idea about apache configuration for revers proxy for opensearch…
This would make Apache redirect any requests starting with / to your backend. The ProxyPassReverse makes it so that the Location headers are re-written to point at the reverse proxy instead of what’s on the backend (in the case of a 302 or 301 redirect).
That should get you started, however I very much suggest referring to the Reverse Proxy guide and experimenting a little bit.
I am able to made some progress on reverse proxy setup for Opensearch dashboard.
The challenge/issue I am facing is when I give port 5601 in proxypass and proxypassrevers the URL is not working at all… When I try to change the port from 5601 to 9200 (opensearch-node) I am getting an output (Opensearch information) on the web browser using proxy URL
Do you have any idea about the DocumentRoot for opensearch-dashbaord? Or is there any setting or configure we can give for a opensearch-dashbaord to get it work.
This is what we have working with Apache (bearing in mind these are docker containers so Apache is listening on external 80/443, but communicating to the dashboard on the docker network on 5601)
There’s some additional bits on proxying to another non-dashboard URI and some authentication stuff, but left those out for brevity.
<VirtualHost *:80>
ServerName localhost
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
<VirtualHost _default_:443>
# General setup for the virtual host
DocumentRoot "/usr/local/apache2/htdocs"
ServerName localhost
ServerAdmin you@localhost
ProxyPass "/" "http://opensearch-dashboards:5601/"
ProxyPassReverse "/" "http://opensearch-dashboards:5601/"
A couple of things seem off to me here, but without more specifics about what is going wrong, I’m afraid I’ll have to throw out a few more guesses.
Firstly, you’re redirecting https requests back to http in your proxypass directive. You probably want to replace http with https in your rewrite target. You may also need to add the directive
SSLProxyEngine on
to be included in your configuration. Can you describe a bit more about what’s not working and we’ll go from there?
P.S. There might be some known-to-be-working examples by searching google for working proxypass configuration examples. There might be some eccentricity of the configuration that I’m missing.
Actually, my config works - it’s a bit incomplete - was just showing a small extract since @sabil had asked for a working example.
If their dashboard is running SSL, then they’ll need to configure such - as I noted, we’re using docker containers, so the dashboard instance is not exposed to any external interfaces, only the docker internal network, while Apache is exposed and running TLS.
Thank you so much for your suggestion and assistance.
I have a solution which is working fine now.
My scenario is little different, we have an application which is running on “/” in reverse proxy and I wanted to run additional application which is “opensearch-dashboard” using apache reverse proxy on another path.
In this scenario I wanted to change the entry point/base URL of opensearch-dashboard to “/opnesearch-dashboard” instead of “/”. To achieve this I have added couple of environment variable to docker-compose.yml file as follows.