Repository navigation
Support extra HTTPS ports with separate certificates - #223
Open
igolaizola wants to merge 1 commit into
Open
igolaizola wants to merge 1 commit into
igolaizola wants to merge 1 commit into
Conversation
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
There was a problem hiding this comment.
🟡 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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