Skip to content

Support extra HTTPS ports with separate certificates - #223

Open
igolaizola wants to merge 1 commit into
httptoolkit:mainfrom
igolaizola:emudhra-port
Open

igolaizola wants to merge 1 commit into
httptoolkit:mainfrom
igolaizola:emudhra-port

Conversation

@igolaizola

Copy link
Copy Markdown
Contributor

Expose named HTTPS configurations in session metadata and enable extra listeners through the admin API. Share rules and events across ports and close listeners with the session.

Refs httptoolkit/httptoolkit#934

Expose named HTTPS configurations in session metadata and enable extra listeners through the admin API. Share rules and events across ports and close listeners with the session.

Refs httptoolkit/httptoolkit#934

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The review found an issue that should be addressed before approval.

2 open issues
What changed in this PR

Adds on-demand HTTPS listeners with separate named certificate configurations, allowing multiple CAs within one Mockttp session while sharing rules and events.

Changes:

  • Exposes named HTTPS configurations and an enable API through local clients, remote clients, and GraphQL.
  • Adds extra-listener creation, port reuse, and session shutdown handling.
  • Adds integration coverage for certificate isolation, supported protocols, remote access, and cleanup.
File Description
src/​server/​mockttp-server.ts Creates, tracks, and closes additional HTTPS listeners.
src/​mockttp.ts Defines named HTTPS options and public setup/metadata APIs.
src/​client/​mockttp-client.ts Exposes configuration names and remote listener activation.
src/​client/​mockttp-admin-request-builder.ts Builds the listener-activation mutation.
src/​admin/​mockttp-schema.ts Adds the GraphQL mutation.
src/​admin/​mockttp-admin-plugin.ts Includes configuration names in session metadata.
src/​admin/​mockttp-admin-model.ts Connects the mutation to the mock server.
test/​integration/​https-ports.spec.ts Tests certificate selection, shared rules, protocols, and listener lifecycle.

Review effort: Balanced

passthroughUnknownProtocols: this.passthroughUnknownProtocols,
keyLogStream: this.keyLogStream,

requestListener: this.app,
if (!mainServer?.listening) throw new Error('Cannot add a port before the server is started');
const startPort = this.port + 1;

const server = await this.createServer({ ...this.httpsOptions, ...httpsOptions });

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants