Skip to content

Nginx fails to reload due to long server name #632

Closed
@kate-osborn

Description

@kate-osborn

Describe the bug
Nginx fails to reload with the following error message:

nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64

To Reproduce
Steps to reproduce the behavior:

  1. Deploy NKG
  2. Create the cafe app:
  3. Apply the following manifest:
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
  name: gateway
  labels:
    domain: k8s-gateway.nginx.org
spec:
  gatewayClassName: nginx
  listeners:
  - name: http
    port: 80
    protocol: HTTP
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: coffee
spec:
  parentRefs:
  - name: gateway
    sectionName: http
  hostnames:
  - "abcdefghijklmn.too.long.server.name.example.org" // 47 characters seems to be the limit
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /coffee
    backendRefs:
    - name: coffee
      port: 80
  1. Get the logs of the nginx container: kubectl logs -n nginx-gateway <nginx-gateway-pod> -c nginx -- nginx -T
    Look for the following error message:
2023/05/09 15:22:56 [emerg] 41#41: could not build server_names_hash, you should increase server_names_hash_bucket_size: 64

Expected behavior
Nginx should reload successfully and the route should be configured.

Your environment

  • Version of the NGINX Kubernetes Gateway: main, commit: d62cf56
  • Version of Kubernetes: 1.26
  • Kubernetes platform (e.g. Mini-kube or GCP): kind

Metadata

Metadata

Assignees

Labels

area/nginx-configurationRelates to nginx configurationbugSomething isn't workingrefinedRequirements are refined and the issue is ready to be implemented.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions