# Access Kibana thru Azure Application Gateway Path Based Route

**URL:** <https://discuss.elastic.co/t/access-kibana-thru-azure-application-gateway-path-based-route/179812>\
**Category:** Kibana\
**Created:** [May 6, 2019, 4:41pm UTC](https://discuss.elastic.co/t/access-kibana-thru-azure-application-gateway-path-based-route/179812 "2019-05-06T16:41:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phydeauxman](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@Phydeauxman](https://discuss.elastic.co/u/Phydeauxman)\
**Post date:** [May 6, 2019, 4:41pm UTC](https://discuss.elastic.co/t/access-kibana-thru-azure-application-gateway-path-based-route/179812/1 "2019-05-06T16:41:19Z")

</div>

We are running Kibana 6.7.1 with XPACK on a VM in Azure. The VM is sitting behind an Azure Web Application Firewall (WAF). We have the WAF configured for path based routing where Kibana is accessed via [https://app.mydomain.com/kibana](https://app.mydomain.com/kibana). We also have a rewrite rule configured on the App Gateway that rewrites the **Location** response header from Kibana to be /kibana/{resp\_http\_Location}. The problem we are seeing is that Kibana keeps looping until the App Gateway shuts down the connection.

From Chrome, when we go to [https://app.mydomain.com/kibana](https://app.mydomain.com/kibana), based on our rewrite rule, the Location response header we get is /kibana/login?next=%2F. The browser then send the request to [https://app.mydomain.com/kibana/login?next=%2F](https://app.mydomain.com/kibana/login?next=%2F) which Kibana responds back with a Location header value of /kibana/login?next=%2F%2Flogin%3Fnext%3D%252F. The browser then sends a request to [https://app.mydomain.com/kibana/login?next=%2F%2Flogin%3Fnext%3D%2F](https://app.mydomain.com/kibana/login?next=%2F%2Flogin%3Fnext%3D%252F) and Kibana responds back with a Location header value of /kibana/login?next=%2F%2Flogin%3Fnext%3D%252F%252Flogin%253Fnext%253D%25252F. This goes back and forth until the App Gateway shuts down the connection.

Not sure what is causing this. Any ideas we can investigate?

---

<div class="post-metadata">

**Author:** ![joelgriffith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joelgriffith/32/53738_2.png) [@joelgriffith](https://discuss.elastic.co/u/joelgriffith)\
**Post date:** [May 10, 2019, 3:21pm UTC](https://discuss.elastic.co/t/access-kibana-thru-azure-application-gateway-path-based-route/179812/2 "2019-05-10T15:21:21Z")

</div>

@Phydeauxman welcome to the elastic discuss forums! My thinking is that query-string parameter of `?next` might be throwing things through a loop since, when decoded, is telling Kibana to navigate to `/`. Without knowing the internals of how Azure's WAF works, it might be redirecting back without any authorization in place, and thus the cycle begins again.

Could you try manually setting your URL to `https://app.mydomain.com/kibana/login?next=%2Fkibana` and see how that responds? If you have Kibana configured to use a `basePath`, then you'd need to set the `?next` parameter to _that_ `basePath` in order to function properly. We have docs on the entirety of Kibana's configuration located here: [https://www.elastic.co/guide/en/kibana/current/settings.html](https://www.elastic.co/guide/en/kibana/current/settings.html). Simply search for `basePath` to read more about it.

Let me know how it goes!

---

<div class="post-metadata">

**Author:** ![Phydeauxman](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@Phydeauxman](https://discuss.elastic.co/u/Phydeauxman)\
**Post date:** [May 13, 2019, 10:26pm UTC](https://discuss.elastic.co/t/access-kibana-thru-azure-application-gateway-path-based-route/179812/3 "2019-05-13T22:26:55Z")

</div>

Thanks @joelgriffith we were able to solve our problem using the `basePath` setting.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 10, 2019, 10:27pm UTC](https://discuss.elastic.co/t/access-kibana-thru-azure-application-gateway-path-based-route/179812/4 "2019-06-10T22:27:00Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
