代码之家  ›  专栏  ›  技术社区  ›  hinewwiner

Kubernetes Ingres重写目标-不管怎样在重写时保留地址?

  •  -1
  • hinewwiner  · 技术社区  · 6 年前

    我有一个运行在pod中的oauth2服务,需要用户向发送请求

    http://[address]/oauth/token?grant_type=client_credentials&scope=[scope]

    例如,当用户向提交请求时,使用下面的入口规则: http://address.com/oauth/token?grant_type=client_credentials&scope=[scope] 然后身份验证服务收到如下请求: http://address.com/token?grant_type=client_credentials&scope=[scope]

    有什么办法解决这个问题吗?

    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: gateway-ingress
      annotations:
        nginx.ingress.kubernetes.io/rewrite-target: /
    spec:
      rules:
      - host: address.com
        http:
            paths:
            - path: /oauth/*
              backend:
                serviceName: auth-service
                servicePort: 8052
    
    0 回复  |  直到 6 年前
        1
  •  1
  •   hinewwiner    6 年前

    我通过删除重写目标注释来解决这个问题。

    我还必须删除/oauth之后的/*

    我希望这能帮助其他人。

    推荐文章