Stefan Walther
Stefan Walther

Reputation: 59

How can I configure RedisInsight Proxy Path in Kubernetes with Nginx ingress?

I am seeking help to get the URL path to work in redisinsight

as per documentation i added config-map envs:

RIPROXYENABLE: "ture" RIPROXYPATH: "/redis" RITRUSTEDORIGINS: "https://host.example.com"

However when I call the service on https://host.example.com/redis/, the bundle.js is returned on the root path https://host.example.com/static/app/bundle.e7efa0031208bf65925b.js

As image is run redislabs/redisinsight:latest

Any insight how I might overcome this? Thank you in advance

I tried to set the RIPROXYPATH: "/redis" to RIPROXYPATH: "/redis/", nginx rewrite of the path. Non had any success.

Upvotes: 2

Views: 2071

Answers (3)

Daniel
Daniel

Reputation: 1893

After reading through this doc, I find a very simple but working solution as follows.

There is only one environment variable you need to configure in your redis-insight.yaml

env:
  - name: RI_PROXY_PATH
    value: "/apps/redis/"

You don't use rewrite rules in your ingress.yaml. That's to say, you just pass the original url intactly to your upstream redis-insight server. And it just works like a charm.

Upvotes: 0

user13059238
user13059238

Reputation: 19

I stumbled upon this unanswered question. I have a similar problem to solve. I found following links that I am exploring. The solution is based on docker so currently I am looking to convert this to Kubernetes world. https://docs.redis.com/latest/ri/using-redisinsight/proxy/

It appears to just set up a proxy server to filter URLs thru, that match the subpath.

Seperately, I am also exploring URL rewrite from this sample to achieve same goals as what redis insight website advises in the above link.

https://kubernetes.github.io/ingress-nginx/examples/rewrite/

Hope this helps. Once I have a precise answer , will be sure to post that.

UPDATE: Here is a solution - thanks to my Boss's second pair of eyes on rewrite rule to catch my missing annotation.

  1. I am using Docker image latest or 1.14 from https://hub.docker.com/r/redislabs/redisinsight/tags

  2. Add following to the Deployment template of your helm chart/container/spces

    env:
       - name: "RIPROXYPATH"
         value: "/rui/"
       - name: "RIPROXYENABLE"
         value: "t"
    
  3. In your redisinsight ingress add following: Reference https://kubernetes.github.io/ingress-nginx/examples/rewrite/ Do not forget annotation.

     annotations:
       nginx.ingress.kubernetes.io/rewrite-target: /$2
     ...
     paths:
           - path: /rui(/|$)(.*)
             pathType: Prefix
             backend:
    

Upvotes: 2

steve
steve

Reputation: 31

Unfortunately I don't have enough reputation to add a comment to @user13059238's excellent answer

For me, I was getting a 403 error when trying to accept the EULA and Privacy Settings, and in the Network tab of my browser I could see the payload was:

{
    "detail": "CSRF Failed: Origin checking failed - https://example.com does not match any trusted origins."
}

So I added RITRUSTEDORIGINS to my environment variables, e.g.

env:
   - name: "RIPROXYPATH"
     value: "/rui/"
   - name: "RIPROXYENABLE"
     value: "t"
   - name: "RITRUSTEDORIGINS"
     value: "https://example.com"

Upvotes: 0

Related Questions