Skip to content

bug: APISIX 3.14.0+ OpenID Connect redirect drops request port (regression vs 3.13.0) #12970

Description

@Mr-EmPee

Current Behavior

Starting from Apache APISIX 3.14.0, the openid-connect plugin generates redirect / callback URLs without the original request port, even when the client accesses APISIX directly (no reverse proxy or load balancer in front).

The same configuration works correctly on APISIX 3.13.0, where the redirect URL preserves the port.

This is a regression and breaks OIDC flows when APISIX is exposed on a non-default port (anything other than 80/443).

Example

$ curl -v http://localhost:8888 2>&1 | grep -i '< Location'
< Location: http://10.126.166.49:8888/auth/realms/warehouse-automation/protocol/openid-connect/auth?scope=openid%20profile&client_id=apisix&redirect_uri=http%3A%2F%2Flocalhost%2F.apisix%2Fredirect&state=f44c18832740fc4486c099a6be0c1329&response_type=code

As you can see the redirect_uri parameter is missing the original request port

Expected Behavior

$ curl -v http://localhost:8888 2>&1 | grep -i '< Location'
< Location: http://10.126.166.49:8888/auth/realms/warehouse-automation/protocol/openid-connect/auth?state=d15ffd15ae044c3d0f1c0583ce9f203e&response_type=code&scope=openid%20profile&redirect_uri=http%3A%2F%2Flocalhost%3A8888%2F.apisix%2Fredirect&client_id=apisix

Error Logs

No response

Steps to Reproduce

  1. Run APISIX 3.14.0+ on port 8888 and configure OIDC plugin
  2. Try to make a curl to a protected route

Environment

  • APISIX: 3.14.1-debian

Metadata

Metadata

Labels

bugSomething isn't workingplugin

Type

No type

Projects

Status
✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions