Git Product home page Git Product logo

Comments (6)

tatsuhiro-t avatar tatsuhiro-t commented on June 7, 2024 1

FYI, next version of this ingress controller will have per-backend mruby scripting, which kicks in after backend has been chosen. It will be the bast place to rewrite request path.

from nghttpx-ingress-lb.

tatsuhiro-t avatar tatsuhiro-t commented on June 7, 2024

There is no feature to strip path prefix at the moment.
nghttpx supports mruby user script which can alter request path, but it happens before routing a request to the backend. If I understand it correctly, you need to rewrite path after determining backend service.

from nghttpx-ingress-lb.

charandas avatar charandas commented on June 7, 2024

@tatsuhiro-t thanks for your comment. Yes, that is correct, I need to rewrite path after determining backend service.

Do you mean to say that when mruby script executes, the backend service has not yet been determined based on path matching, so rewriting path there would cause it to fail the match?

I may have to modify the application code itself to honor the prefix if I cannot strip it.

from nghttpx-ingress-lb.

charandas avatar charandas commented on June 7, 2024

Also, maybe there is the possibility of defining the matching paths to just be filing, public and admin in my example, but let consumers use the prefix.

Then, in the mruby script, rewrite path to not have prefix. Then path matching should pass.

from nghttpx-ingress-lb.

tatsuhiro-t avatar tatsuhiro-t commented on June 7, 2024

Do you mean to say that when mruby script executes, the backend service has not yet been determined based on path matching, so rewriting path there would cause it to fail the match?

Yes

Also, maybe there is the possibility of defining the matching paths to just be filing, public and admin in my example, but let consumers use the prefix.

Then, in the mruby script, rewrite path to not have prefix. Then path matching should pass.

I think it works. You might need to do some actions to prevent consumer from accessing /public directly in mruby if it is required.

from nghttpx-ingress-lb.

charandas avatar charandas commented on June 7, 2024

@tatsuhiro-t thanks for trying to help out. It seems any kind of mruby manipulation of the path ends up dictating later decision making of choosing the backend fail in my case. My line of thought would only work if mruby kicked in after backend was chosen.

In any case, I got this to work for my use-case:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: hmda-platform-ingress
spec:
  rules:
  - host: 'filing.myhmdaapp.com'
    http:
      paths:
      - path: /
        backend:
          serviceName: hmda-platform-api
          servicePort: filing
  - host: 'admin.myhmdaapp.com'
    http:
      paths:
      - path: /
        backend:
          serviceName: hmda-platform-api
          servicePort: admin
  - host: 'public.myhmdaapp.com'
    http:
      paths:
      - path: /
        backend:
          serviceName: hmda-platform-api
          servicePort: public

Then accessing whichever one using the correct Host headers.

curl -H "Host: filing.myhmdaapp.com" -i http://ingress-address

Closing this issue for now.

from nghttpx-ingress-lb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.