apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: appflowy-gotrue-ingress
  namespace: appflowy
  annotations:
    nginx.ingress.kubernetes.io/use-regex:   "true"
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/proxy-body-size: "50m"
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec:
  ingressClassName: nginx

  tls:
    - hosts:
        - orbit.panic.haus
      secretName: appflowy-tls

  rules:
    - host: orbit.panic.haus
      http:
        paths:
          # GoTrue: rewrite /gotrue(/|$)(.*) → /$2
          - path: /gotrue(/|$)(.*)
            pathType: ImplementationSpecific
            backend:
              service:
                name: gotrue
                port:
                  number: 9999