Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL Error in when Upgrading from node 16 to 18 #979

Closed
2 tasks done
didiaoshengjianbao opened this issue Apr 3, 2024 · 3 comments
Closed
2 tasks done

SSL Error in when Upgrading from node 16 to 18 #979

didiaoshengjianbao opened this issue Apr 3, 2024 · 3 comments

Comments

@didiaoshengjianbao
Copy link

Checks

Describe the bug (be clear and concise)

When I try to upgrade from node 16 to 18, I met the error thrown like belows:
Forward api error: write EPROTO C0FACBFD01000000:error:0A000410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1605:SSL alert number 40
All is ok when I use 16 to start my node, any walkround for this?

Step-by-step reproduction instructions

1. using node 18
2. error thrown
3. switch to node 16, all is ok, but I have to use node 18 for some reasons.

Expected behavior (be clear and concise)

No Error throwm

How is http-proxy-middleware used in your project?

"http-proxy-middleware": "^2.0.2",

What http-proxy-middleware configuration are you using?

server.use(context,
      createProxyMiddleware(requestURIConfig + context, {
        logLevel: 'debug',
        // replace target config with router config for dynamic matching
        router: (req) => getTarget(req).url,
        secure: false,
        changeOrigin: true,
        pathRewrite: {
          // @see https://github.com/chimurai/http-proxy-middleware#http-proxy-middleware-options
          [`^${requestURIConfig}${context}`]: '',
        },
        onProxyReq(proxyReq, req) {
          const user = getUser(req);

          if (user) {
            proxyReq.setHeader(HEADER_USER_ID, user);
          }
          if (checkNeedToken(req)) {
            proxyReq.setHeader(HEADER_TOKEN, tokenResult[user] || '');
            proxyReq.setHeader(IHUB_TOKEN, vertexLogHeader[user].ihubToken || '');
            proxyReq.setHeader(TNONCE, vertexLogHeader[user].tnonce || '');
          }
          overrideSlackHeader(proxyReq, req);
          overrideDataDogHeader(proxyReq, req);
          addIdentityRoleHeader(proxyReq, req);
          headersHandler(proxyReq, getTarget(req));
          logger.log({ type: 'context', name: 'forward', message: `forward-request: ${req?.path}` }, req);
          logger.log({ type: 'context', name: 'forward', message: `forward_headers_final: ${JSON.stringify(req?.headers)}` }, req);
        },
        onProxyRes(proxyRes, req) {
          const { headers } = proxyRes;
          // disable cache for API forwarding.
          headers['Cache-Control'] = 'no-store';
          logger.log({ type: 'context', name: 'received', message: `forward-received: ${req.path}` }, req);
        },
        onError(err, req, res) {
          logger.error(`Forward api error: ${err.message}.`, req);
          res.writeHead(500, {
            'Content-Type': 'text/plain',
          });
          res.end('Something went wrong. We are reporting a custom error message.');
        },
      }))

What OS/version and node/version are you seeing the problem?

Macos:14.4
Node 18

Additional context (optional)

No response

@didiaoshengjianbao
Copy link
Author

More info: I upgrade to the latest version and still got the same ssl error
image

@chimurai
Copy link
Owner

chimurai commented Apr 5, 2024

Looks more like a certificate issue than a proxy issue.

Without minimal reproduction there is little I can do.

Did you try to enable DEBUG?

# show only HPM debug info (only available in HPM v3)
DEBUG=http-proxy-middleware* node server.js
# show all debug info
DEBUG=* node server.js

https://github.com/chimurai/http-proxy-middleware?tab=readme-ov-file#debugging

@didiaoshengjianbao
Copy link
Author

It's cert issue, not related to the lib.

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

No branches or pull requests

2 participants