Skip to content

BadRequestError: request aborted while calling /health endpoint #789

@kumarimanjari

Description

@kumarimanjari

Checks

Describe the bug (be clear and concise)

We have an express server where /health endpoint is present (GET method).

There is an external system which tries to call /health endpoint so that it can check the status and process further.
But whenever other system tries to call it, we see below error in our log

BadRequestError: request aborted
[HPM] Error occurred while proxying request <source_url> to <target_url>
[ECONNRESET] (https://nodejs.org/api/errors.html#errors_common_system_errors)

Step-by-step reproduction instructions

1. calling the /health endpoint from a different system

Expected behavior (be clear and concise)

We should be able to get 200 status HTTP code, whenever we /health endpoint is called.

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

We have an express server created as below: 
app.use('*', <middleware>, createProxyMiddleware({target, changeOrigin, onProxyReq: <function>, selfHandleResponse: true, onProxyRes: <function> })

Version -> http-proxy-middleware - ^2.0.0, I know this is not the latest version, but I tried that as well, it didn't solved the issue.

What http-proxy-middleware configuration are you using?

createProxyMiddleware({
    target,
    changeOrigin,
    onProxyReq: ****,
    selfHandleResponse: true,
    onProxyRes: ****,
  })

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

Node Version -> v14.16.0-alpine3.13

Additional context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions