Skip to content

Getting Invalid Host header error in browser with https URL #753

Open

Description

@rajeshojha-gep

Hi,

I hosted this unity catalog in Azure Kubernetes (AKS Cluster) and trying to hit unitycatalog-ui service through nginx, but I am getting error "Invalid Host header".
Same working fine if I browse Private IP of service on port 80.

Steps to reproduce the behavior:

  1. Create Nginx LB
    helm install ingress-nginx-unitycatalog ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --version v4.8.3 --set controller.replicaCount=2 --set controller.ingressClassResource.name=ingress-nginx-unitycatalog --set controller.ingressClassResource.enabled=true --set controller.watchIngressWithoutClass=true --set controller.ingressClassByName=true --set controller.ingressClass=ingress-nginx-unitycatalog --set controller.ingressClassResource.controllerValue="k8s.io/ingress-nginx-unitycatalog" --set controller.service.annotations."service.beta.kubernetes.io/azure-load-balancer-health-probe-request-path"=/healthz --namespace unitycatalog --set controller.nodeSelector."kubernetes.io/os"=linux

  2. Host unitycatalog-UI also as service
    apiVersion: v1
    kind: Service
    metadata:
    name: unitycatalog-ui
    labels:
    app: unitycatalog
    spec:
    selector:
    app: unitycatalog
    component: ui
    ports:

    • protocol: TCP
      port: 80 # Exposes port 80 externally
      targetPort: 3000 # Mapped to internal port of the UI container
      type: LoadBalancer # This will expose the UI externally

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/issuer: DigiCert SHA2 Secure Server CA
kubernetes.io/ingress.class: ingress-nginx-unitycatalog
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
nginx.ingress.kubernetes.io/cors-allow-methods: '*'
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/proxy-body-size: "0"
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/server-alias: unitycatalogdev.com
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.org/client-max-body-size: "0"
name: ingress-nginx-unitycatalog
namespace: unitycatalog
spec:
rules:

  • host: unitycatalogdev.com
    http:
    paths:
    • path: /
      pathType: ImplementationSpecific
      backend:
      service:
      name: unitycatalog-ui
      port:
      number: 80
      tls:
  • hosts:
    • unitycatalogdev.com
      secretName: aks-latest-ingress-tls
  1. Browse the url unitycatalogdev.com you will get
    Invalid Host header

Expected behavior
same behavior as http but now it should work with https also.

Activity

  1. added
    bug
    on Nov 22, 2024
  2. mblaauw commented on Feb 6, 2025

    @mblaauw

    Issue here seems to be that when you start the UI with yarn start or npm run start, it launches a dev server with websocket/hot reload functionality. This combines badly with a k8s ingress. Workaround is to yarn build it and the serve it via a more straight forward webserver.

    Note: patching of utils/constants.ts is likely needed as you loose the proxy ref in the package.json which then leads to CORS issues which you can solve with the correct annotations on your ingress

  3. hangnality commented on Apr 28, 2025

    @hangnality

    I encountered the same error in my Docker Compose. Setting the environment variable DANGEROUSLY_DISABLE_HOST_CHECK=true resolved it.
    Reference: https://stackoverflow.com/questions/46794256/react-scripts-invalid-host-header

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions