Configure traefik to use authentication server and forward request to Elasticsearch

Hi Folks,

We have a requirement to have Traefik use middleware called ForwardAuth to pass the queries to service Auth Service (part of docker swarm cluster) to get the token validated then traefik should forward the query to Elasticsearch. We already have reverse proxy rules on apache config, which will eventually be replaced by traefik..

authoritah

curl -XGET https://:<custom_port>/_search/_cat/indices/index* -H ":sample"

The Flow of request would be : Client --> Apache --> Traefik --> Auth Service <--> Traefik --> Elasticsearch

I have noticed request is not landing the Auth service and end up getting a 404 error.

AH00944: connecting http://traefik:9000/_cat/indices/index* to traefik:9000
[Tue Jul 20 04:59:59.822927 2021] [proxy:debug] [pid 38:tid 139765106026240] proxy_util.c(2717): [client 103.66.79.66:64860] AH00947: connected /_cat/indices/index* to traefik:9000
<Location "/_search/">
    LogLevel proxy:debug
    LogLevel trace5
    ProxyPreserveHost On
    ProxyPass  http://${traefik_endpoint}/ disablereuse=on
    ProxyPassReverse  http://${traefik_endpoint}/
    RequestHeader set Authorization "Basic ${somevalue}"
</Location>

Please can you let me know if its an issue with traefik routing or apache is an issue.