mayankmurari opened a new issue, #2537:
URL: https://github.com/apache/apisix-ingress-controller/issues/2537

   ### Issue description
   
   When using APISIX Gateway API with an external upstream service, receiving 
400 Bad Request errors from APISIX itself (not the upstream). APISIX is 
returning HTML error pages instead of proxying requests to the upstream 
service, suggesting a configuration or protocol mismatch in the Gateway API 
implementation.
   
   `<html>
   <head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
   <body>
   <center><h1>400 Bad Request</h1></center>
   <center>The plain HTTP request was sent to HTTPS port</center>
   <hr><center>openresty</center>
   <p><em>Powered by <a 
href="https://apisix.apache.org/";>APISIX</a>.</em></p></body>
   </html>`
   
   **Environment**
   - APISIX version: 3.13.0
   - APISIX Ingress Controller: 2.0.0-rc2
   - Deployment mode: Standalone (apisix-standalone provider)
   - Gateway API: v1
   - Platform: Kubernetes
   
   **To Reproduce**
   
   1. Create ExternalName service for HTTPS upstream:
   ```yaml
   apiVersion: v1
   kind: Service
   metadata:
     name: test-health-service
     namespace: ingress-apisix
   spec:
     type: ExternalName
     externalName: external-api-service.example.com
     ports:
     - port: 443
       targetPort: 443
       protocol: TCP
       name: https
   ```
   
   2. Create HTTPRoute with HTTPS upstream scheme:
   ```yaml
   apiVersion: gateway.networking.k8s.io/v1
   kind: HTTPRoute
   metadata:
     name: healthcheck-route
     namespace: ingress-apisix
   spec:
     parentRefs:
     - name: apisix-gateway
       namespace: ingress-apisix
     hostnames:
     - "api-gateway.example.com"
     rules:
     - matches:
       - path:
           type: Exact
           value: "/v1/healthcheck/status"
         method: GET
       backendRefs:
       - name: test-health-service
         port: 443
         weight: 100
   ```
   
   3. Send request to the endpoint:
   ```bash
   curl -v https://api-gateway.example.com:9443/v1/healthcheck/status
   ```
   
   **Expected behavior**
   Request should be successfully proxied to the upstream service and return 
the actual API response.
   
   **Actual behavior**
   Receiving 400 Bad Request with HTML error page. The response shows `server: 
APISIX/3.13.0` indicating APISIX is generating the error, not the upstream.
   
   **APISIX Log**
   
   From APISIX access logs:
   ```json
   {
     "response": {
       "size": 500,
       "headers": {
         "content-type": "text/html; charset=utf-8",
         "content-length": "327",
         "connection": "close",
         "server": "APISIX/3.13.0",
         "date": "Tue, 12 Aug 2025 17:15:10 GMT"
       },
       "status": 400
     },
     "route_id": "71843b52",
     "apisix_latency": 6.0000629425049,
     "request": {
       "url": "https://api-gateway.example.com:9443/v1/healthcheck/status";,
       "querystring": {},
       "headers": {
         "host": "api-gateway.example.com"
       },
       "uri": "/v1/healthcheck/status",
       "method": "GET"
     },
     "service_id": "71843b52",
     "latency": 9.0000629425049,
     "client_ip": "10.0.0.100",
     "upstream_latency": 3,
     "server": {
       "version": "3.13.0",
       "hostname": "apisix-pod-xxxxx"
     },
     "upstream": "10.1.3.120:443"
   }
   ```
   
   ### Environment
   
   - your apisix-ingress-controller version (output of 
apisix-ingress-controller version --long): 
apache/apisix-ingress-controller:2.0.0-rc2
   - your Kubernetes cluster version (output of kubectl version): v1.31.6
   - if you run apisix-ingress-controller in Bare-metal environment, also show 
your OS version (uname -a): 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan  2 
20:24:22 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6041 arm64
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to