You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "mayankmurari (via GitHub)" <gi...@apache.org> on 2025/09/01 11:48:12 UTC
[I] request help: Gateway API upstream returning 400 error with HTML response - Port and domain mismatch analysis [apisix-ingress-controller]
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: notifications-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] request help: Gateway API upstream returning 400 error with HTML response [apisix-ingress-controller]
Posted by "kayx23 (via GitHub)" <gi...@apache.org>.
kayx23 commented on issue #2537:
URL: https://github.com/apache/apisix-ingress-controller/issues/2537#issuecomment-3244324907
Might be missing the BackendTrafficPolicy configuration that configures the HTTPS scheme? e.g.
```yaml
apiVersion: apisix.apache.org/v1alpha1
kind: BackendTrafficPolicy
metadata:
name: passhost-node
spec:
targetRefs:
- name: test-health-service
kind: Service
group: ""
scheme: https
```
Please check out the ingress controller docs under the TLS and mTLS section to see if anything helps: https://docs.api7.ai/apisix/how-to-guide/traffic-management/tls-and-mtls/configure-upstream-https
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] request help: Gateway API upstream returning 400 error with HTML response [apisix-ingress-controller]
Posted by "bzp2010 (via GitHub)" <gi...@apache.org>.
bzp2010 commented on issue #2537:
URL: https://github.com/apache/apisix-ingress-controller/issues/2537#issuecomment-3242620314
@mayankmurari Is there any load balancer in front of your APISIX that can be configured for TLS termination?
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] request help: Gateway API upstream returning 400 error with HTML response [apisix-ingress-controller]
Posted by "mayankmurari (via GitHub)" <gi...@apache.org>.
mayankmurari commented on issue #2537:
URL: https://github.com/apache/apisix-ingress-controller/issues/2537#issuecomment-3244128327
Hi @bzp2010 We have configured TransportServer which is taking HTTPS traffic. This TS points to a NodePort service.
Apisix gets traffic on TransportServer
virtualServerAddress: x.x.x.x
virtualServerPort: 443
TS forwards traffic to NodePort service
service: apisix-gateway
servicePort: 443
Client (HTTPS:443)
↓ TLS encrypted
F5 Load Balancer (x.x.x.:443) TLS Passthrough
↓
APISIX Gateway (apisix-gateway:443) TLS TERMINATION
Also we have set up backend proxy in Apisix using APISIX resources "apisixroutes" and "apisixupstreams" and we do not see any issue there.
Below is the Gateway setup.
**Apisix-ts**
apiVersion: cis.f5.com/v1
kind: TransportServer
metadata:
labels:
f5cr: "true"
use_cis: "true"
name: apisix-ts
namespace: ingress-apisix
spec:
mode: standard
pool:
loadBalancingMethod: round-robin
monitor:
interval: 10
timeout: 5
type: tcp
service: apisix-gateway
servicePort: 443
snat: auto
type: tcp
virtualServerAddress: x.x.x.x
virtualServerPort: 443
**Service**
ports:
- name: apisix-gateway
nodePort: 30914
port: 80
protocol: TCP
targetPort: 9080
- name: apisix-gateway-tls
nodePort: 30609
port: 443
protocol: TCP
targetPort: 9443
**Gateway**
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: apisix-gateway
namespace: ingress-apisix
spec:
gatewayClassName: apisix
listeners:
# HTTPS Listener for secure requests
- name: https
protocol: HTTPS
port: 9443
allowedRoutes:
namespaces:
from: Same
tls:
mode: Terminate
certificateRefs:
- name: apisix-ssl
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] request help: Gateway API upstream returning 400 error with HTML response [apisix-ingress-controller]
Posted by "bzp2010 (via GitHub)" <gi...@apache.org>.
bzp2010 closed issue #2537: request help: Gateway API upstream returning 400 error with HTML response
URL: https://github.com/apache/apisix-ingress-controller/issues/2537
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] request help: Gateway API upstream returning 400 error with HTML response [apisix-ingress-controller]
Posted by "bzp2010 (via GitHub)" <gi...@apache.org>.
bzp2010 commented on issue #2537:
URL: https://github.com/apache/apisix-ingress-controller/issues/2537#issuecomment-3244453259
@mayankmurari
I'm not familiar with the F5 Ingress Controller, but I reviewed its documentation. If you want to pass-through TLS on the load balancer, you need a TLSProfile ([ref](https://clouddocs.f5.com/containers/latest/userguide/crd/tlsprofile.html#tlsprofile-components)) and must specify `termination` as either `passthrough` or `reencrypt`.
This detail is missing from the information you provided, though you mentioned having configured it. Please double-check, have you configured that option?
---
@kayx23
This issue occurred before APISIX. Plaintext traffic stripped of TLS was sent to the APISIX HTTPS port, which is not functional. Furthermore, this appears unrelated to the upstream.
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org