How to configure consul to access webpage from Ingress gateway

0

I am trying to configure ingress gateway for consul deployed in aks.

As per their documentation, I have created a sample deployment and ingress gateway to it.

yaml files: github

kubectl apply -f static-app/

I changed the static app service from CluserIP to LoadBalancer and can get the page using http://<LB_IP>

But, with ingress gateway, I can access only by adding the header as below. curl -H “Host: static-server.ingress.consul” “http://<IG_IP>:8080”

if I try without header, it is not getting the page.

Any suggestion on how to make it work without header, so that I can utilize the same for my main application.

Once, it is deployed, I am able to see in the consul window and got the ip address of the ingress-gateway using

Hi @ukreddy-erwin,

When an ingress gateway’s listener is configured with a protocol of http, the HTTP Host header is normally required to be sent in request so that the gateway can route to the correct backend service. That requirement is documented on the hosts field under the ingress gateway configuration entry, and on the initial paragraphs in External <> Internal Services - Ingress Gateways | Consul by HashiCorp.

The exception is when the Hosts field contains a wildcard. This will match on any Host value, or in your case the absence of the Host header, and route those requests to the specified service.

apiVersion: consul.hashicorp.com/v1alpha1
kind: IngressGateway
metadata:
  name: ingress-gateway
spec:
  listeners:
    - port: 8080
      protocol: http
      services:
        - name: static-server
          hosts: ['*']

I hope this helps. Please let me know if you have any additional questions.

P.S. - I replied to your issue on GitHub (hashicorp/consul#10592) last night. At the time I didn’t realize that you had also here. Lets continue the conversation on this thread.