Do you want to request a feature or report a bug?
Bug.
What is the current behavior?
HTTP HEAD method requests result in a 404: Not Found even though the resource exists and is retrievable using HTTP GET.
If the current behavior is a bug, please provide the steps to reproduce.
Compile using webpack and request any file:
$> curl -I http://localhost:8080/index.html
HTTP/1.1 404 Not Found
X-Powered-By: Express
Content-Security-Policy: default-src 'self'
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=utf-8
Content-Length: 158
Date: Sun, 28 May 2017 09:35:14 GMT
Connection: keep-alive
$> curl -G http://localhost:8080/index.html
md5-de023593d4b800fb9413c1bc71aeabb4
Please mention your webpack and Operating System version.
Tested on Windows 10 with dev server 2.4.5 and webpack 2.6.1
you can go with this code of proxy:
'/my_url/**': {
target: config.targetLocal,
bypass: (req) => {
req.method = 'GET';
},
},
You can use the proxy method, or you'll have to extend the middleware to handle HEAD requests. At present it only supports GET. You can view some of the setup for that here. I think this would be a little too edge case to make it a permanent part of WDS.
Why this is closed? It is a normal use case to check etag with HEAD request. This req.method = 'GET'; is just unneeded hacking.
@shellscape It's also a common use-case to use a HEAD request to check whether the server is running. Can you please reopen?
Example: https://github.com/sindresorhus/wait-for-localhost/blob/master/index.js
+1 Please add support for HEAD method requests as it is a common HTTP Method to use instead of GET when only the headers are needed.
Also critical is using method HEAD for checking if the css file exists: https://github.com/addyosmani/critical/blob/master/src/file.js#L115
FYI @addyosmani @bezoerb