From ddb1c05e7daed956bf7e09a69387a29c91e9cb74 Mon Sep 17 00:00:00 2001 From: Divyansh Tripathi Date: Fri, 24 Feb 2023 12:07:43 +0530 Subject: [PATCH] Expose actuator metrics through nginx server (#14) On enabling prometheus metrics the `/actuator/prometheus` path is redirected to the UI itself because of the nginx rule. This will expose the actuator routes (health,info,prom) to the user --- docker/config/nginx.conf | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docker/config/nginx.conf b/docker/config/nginx.conf index 652721d..6cbb43b 100644 --- a/docker/config/nginx.conf +++ b/docker/config/nginx.conf @@ -29,6 +29,17 @@ server { proxy_cache_bypass $http_upgrade; proxy_redirect off; } + + location /actuator { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://localhost:8080/actuator; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_cache_bypass $http_upgrade; + proxy_redirect off; + } location /swagger-ui { proxy_set_header X-Real-IP $remote_addr; @@ -41,4 +52,4 @@ server { proxy_redirect off; } -} \ No newline at end of file +}