I want to configure nginx to act as a reverse proxy that will redirect to two different Kibana hosts depending on the passed URI. /
redirect to the standard and /october/
to the october dedicated Kibana. The first part of the configuration (/
) works well but I got a Too many redirections
error when a try to access /october
. I tried to comment out the second part (location /october/
) and replace localhost
by 10.10.0.3
in the first one and I'm redirected to the october platform. So the problem is on this nginx configuration.
server { listen 80; server_name my.domain.io; return 301 https://$server_name; } server { listen 443 ; ssl on; ssl_certificate /etc/letsencrypt/live/my.domain.io/cert.pem; ssl_certificate_key /etc/letsencrypt/live/my.domain.io/privkey.pem; server_name my.domain.io; access_log /var/log/nginx/kibana.access.log; error_log /var/log/nginx/kibana.error.log; location / { auth_basic "Restricted"; auth_basic_user_file /etc/nginx/conf.d/kibana.htpasswd; location / { proxy_pass http://localhost:5601; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } location /october/ { proxy_pass http://10.10.0.3:5601; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } } }
ssl
directive in yourlisten
directive. HTTPS doesn't work with this configuration.It is recommended to use the ssl parameter of the listen directive instead of this directive.
Hence his config must still work withssl on;
/october/