Skip to content

pm2 serve returns 403 Forbidden for all static files on Windows (v7.0.0 and v7.0.1) #6109

@AIemao

Description

@AIemao

Description

pm2 serve returns HTTP 403 Forbidden for all static files on Windows.
This regression was introduced in v7.0.0 and is NOT fixed in v7.0.1.

Downgrading to v6.0.14 immediately resolves the issue.

Environment

  • OS: Windows 10 (x64)
  • PM2: 7.0.0 and 7.0.1 (both affected)
  • Node.js: Tested with v14.20.1 and v22.19.0 — same result on both
  • Scale: Confirmed on multiple machines across different store locations

Steps to Reproduce

  1. Install PM2 7.x on Windows: npm install pm2@7 -g
  2. Run: pm2 serve <build-folder> --name front --port XXXX
  3. Open browser at http://localhost:XXXX

Expected Behavior

Static files (JS, CSS) are served correctly with HTTP 200.

Actual Behavior

All requests to static files return HTTP 403 Forbidden:
GET http://localhost:XXXX/static/js/main.chunk.js → 403 Forbidden
GET http://localhost:XXXX/static/css/main.chunk.css → 403 Forbidden

Even curl -I http://localhost:XXXX/static/js/main.chunk.js from the
server itself returns 403.

Root Cause Suspicion

The v7.0.0 changelog mentions:

Replace url.parse() with native URL constructor (Serve, Utility, CliAuth)

This rewrite of the Serve module likely introduced a path handling
regression specific to Windows (backslash vs forward slash).

Workaround

Downgrade to v6.0.14:
npm install pm2@6.0.14 -g

This immediately resolves the 403 errors on all affected machines.

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