Skip to content

Automatically replying to OPTIONS requests is potentially problematic #4551

Closed
@MarceloZabini

Description

@MarceloZabini

Bug report

OPTIONS requests are automatically handled by webpack-dev-server since #4180 was implemented by #4185, bypassing the application's backend.

Actual Behavior

webpack-dev-server automatically replies to OPTIONS requests regardless of how the backend application would handle it.

Expected Behavior

Much like any other kind of requests, like GET and POST, OPTIONS requests should by default be forwarded to the application. Applications can reply with a failure depending on the request, and can include a variety of response headers which can be important for the application.

How Do We Reproduce?

Use webpack-dev-server 4.10.0, which contains #4185, and any application that handles OPTIONS requests in the backend to see that the backend application isn't even contacted.

Please paste the results of npx webpack-cli info here, and mention other relevant information

System:
OS: Linux 5.14 Fedora 33 (Workstation Edition) 33 (Workstation Edition)
CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Memory: 7.60 GB / 15.38 GB
Binaries:
Node: 14.19.3 - /nix/store/cnma41dzr06jp8j6vigfp4lmy1dqfg3x-nodejs-14.19.3/bin/node
npm: 6.14.17 - /nix/store/cnma41dzr06jp8j6vigfp4lmy1dqfg3x-nodejs-14.19.3/bin/npm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions