Skip to content

Fallback proxy doesn't work on Node v17+Β #814

@mirismaili

Description

@mirismaili

Environment Versions

  1. OS Type: Windows 11
  2. Node version: 16.14.2 & 17.9.0 & 18.0.0 & 18.2.0
  3. http-server version: 14.1.0

Steps to reproduce

http-server --proxy http://localhost:8080? doesn't redirect deep paths to the root.

I use NVM. When I switch to node.js v16.14.2 everything works well. But not on v17.9.0, v18.0.0 and v18.2.0.

Expected result

[2022-05-22T23:06:05.765Z]  "GET /en/org" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"
(node:2160) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
[2022-05-22T23:06:05.780Z]  "GET /?/en/org" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"
[2022-05-22T23:06:05.863Z]  "GET /env-config.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"
[2022-05-22T23:06:05.868Z]  "GET /?/env-config.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"
[2022-05-22T23:06:06.027Z]  "GET /static/js/main.bundle.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36"
...

Actual result

[2022-05-22T22:50:53.564Z]  "GET /en/org" Error (404): "connect ECONNREFUSED ::1:8080"
[2022-05-22T22:50:53.564Z]  "GET /en/org" Error (404): "Not found"
[2022-05-22T22:50:53.566Z]  "GET /en/org" Error (404): "Not found"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions