Question: Is it possible to expose all the Spring metrics in an rest endpoint?

In our environment Micrometer cannot forward directly the metrics to our monitoring system, then my idea was to have all the metrics exposed in a rest endpoint (or on a file, json format but the endpoint is preferable) and then having a script to fetch all the metrics at once, manipulate the payload and forward the metrics to our customized monitoring api.

If micrometer is not the right choice, what is it?

**EDIT**

I tried to use the actuator/prometheus endpoint. I can see the endpoint but as soon as I hit the endpoint, it hang and does not return anything:

I am using spring boot 2.2.2 and I added this dependency

```
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
    <version>1.3.1</version>
</dependency>

```

application.yml

```
management:
  endpoints:
   web:
     exposure:
     include: health, metrics, prometheus

```

Answer: 
You may use this redirect rule in your site root .htaccess:

```sh
RewriteEngine On

RewriteCond %{HTTP_HOST} ^(?:www\.)?website\.com$ [NC]
RewriteRule ^reservation/?$ https://test.com/test/page [L,NC,R=301]

```

Query string and fragment i.e. part after `#` will automatically be forwarded to the new URL.
Based on your shown samples, could you please try following. Where you want to redirect from `(www).website.com` to `new-website.com` in url.

Please make sure you clear your browser cache before testing your URLs.

```
RewriteEngine ON
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.*) [NC]
RewriteRule ^ https://new-%1/test/page#!%{REQUEST_URI} [QSA,NE,R=301,L]

```