Skip to content

Commit

Permalink
feat: add untrusted cert error message
Browse files Browse the repository at this point in the history
feat: add untrusted cert error message
  • Loading branch information
janmonschke committed May 28, 2021
1 parent 1213282 commit d516b57
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/createProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,21 @@ export async function createProxy(
addRoutes(server, proxyConfig);
server.events.on('log', (event, tags) => {
if (tags.error) {
log.error(
`Server error: ${
event.error ? (event.error as any).message : 'unknown'
}`
);
let message = event.error ? (event.error as any).message : 'unknown';
if (message.includes('alert bad certificate')) {
message = `${message}
intervene attempts to trust the certificate with the operating system when supported.
This works for some browsers but not all (e.g. Firefox).
For Firefox, open the requested URL in your browser and add a security exception for the certificate.
For Chrome on Linux, make sure you have certutil available - package libnss3-tools under Debian based distributions
(e.g. Ubuntu) and restart intervene.
For other browsers or operating systems, refer to your browser or tool documentation about accessing URLs with untrusted certificates.
`;
}
log.error(`Server error: ${message}`);
} else {
log.error((event.error as any).message);
}
Expand Down

0 comments on commit d516b57

Please sign in to comment.