Skip to content

[feature]: Add SSE port, protocol-level port config, and replaceWith port mapping #3974

@officialasishkumar

Description

@officialasishkumar

👀 Is there an existing feature request for this?

  • I have searched the existing issues

🔖 Enhancement description

Add fine-grained port control for replay target resolution, specifically:

  1. ssePort — A new top-level config field (test.ssePort) and CLI flag (--sse-port) that overrides the HTTP port for SSE (Server-Sent Events) test cases. SSE requests are detected via text/event-stream in the response Content-Type or request Accept header.

  2. protocol section — An extensible, map-based protocol config under test.protocol that allows per-protocol port overrides:

    test:
      protocol:
        http:
          port: 8000
        sse:
          port: 8047
        grpc:
          port: 8034

    New protocols or new keys within a protocol can be added in the config file without code changes.

  3. replaceWith.port mapping — A port-to-port mapping inside replaceWith (both global and per-test-set) that acts as the highest-priority port override:

    test:
      replaceWith:
        global:
          port:
            8033: 8043
        test-sets:
          sse:
            port:
              8033: 8043

Updated priority order (lowest → highest):

  1. Recorded app_port
  2. test.port / test.grpcPort / test.ssePort
  3. test.protocol.<proto>.port
  4. replaceWith URL (if replacement contains explicit port)
  5. replaceWith.port mapping (highest, overrides everything)

🎤 Why should this be worked on?

Currently Keploy only supports a single port for all HTTP requests and a separate grpcPort for gRPC. When an application serves both regular HTTP and SSE endpoints on different ports, there is no way to route SSE test cases to a different port during replay.

Real-world use cases:

  • Microservices with SSE: Apps that serve REST on one port and SSE (e.g. real-time notifications, AI streaming responses) on another.
  • Protocol-aware routing: Different protocols may run on different ports in development vs production. The protocol config enables this without juggling replaceWith URL rules.
  • Port migration during replay: When replaying against a different environment, the replaceWith.port mapping provides a clean way to remap ports without rewriting full URLs.

💻 Repository

keploy

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions