reactjsserverproxylocalhosthttp-proxy-middleware

Error occurred while proxying request - CERT_HAS_EXPIRED


After spending some considerable amount of time trying to solve this, here I am seeking some help about this issue.

Problem

[HPM] Error occurred while proxying request localhost:3000/auth/authentication-api/clinic/user/login to https://xyxyx.clinic/ [CERT_HAS_EXPIRED] (https://nodejs.org/api/errors.html#errors_common_system_errors)

So I am not able to to make a POST request of the 'login credentials body data; to the https://xyxyx.clinic/ path and also getting a 500 Internal Server Error in the browser's network tab inside the dev tools.

What I have done so far to solve this

enter image description here

My findings

I asked someone else to run this repo in their PC and it was working well - they could log in and out. Am I missing any steps something here ??


Solution

  • ANSWER

    Adding "secure:false" solved the issue. So basically secure="false" means requests from both HTTP and HTTPS are allowed.

    app.use(
    '/api',
    createProxyMiddleware({
      target: 'https://xyxy.clinic/',
      changeOrigin: true,
      secure: false,
    }),
    

    )