-
-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to HEAD requests and Last-Modified response header #749
Comments
Last-Modified is hot help here, webpack-dev-server always reload the page when new compilation happens, I think you do not quite understand how it works. What is the real use case for this feature? |
Please provide more information |
And we already have |
I need some time to elaborate more on my inital explanation; but I'd like to know more about this:
Good! |
You should update |
I'm using I'll report back ASAP. Thank you. |
Ok, I updated the dependencies, ending up with:
For simplicity I started the project locally on my computer and with npm start (so without Docker); Node is I still get 404 on an existing page:
but GET gives 200:
Do I have to enable some option or similar? |
I tried to look around the whole dependencies, initializations and configurations from I however tried to explicitly add the methods config as stated in the README, I'm sure my changes are being picked up because I had errors when they weren't correctly written. But I'm still getting the above results, 200 on GET, 404 on HEAD on the same path. Just as a counter-test, I tried sending
|
I just noticed that I obtain 200 even when I issue a
|
Thinking twice about the results in my latest post, they look correct to me: the In fact, GET and HEAD to
So the issue involves subpaths only, it seems, with the server returning 200 to GET requests but 404 to HEAD ones, issued on the same subpath. |
Sorry, please open an issue in create-react-app, we support HEAD, please read code |
|
Sure, but isn't webpack who replies to any subpath here, always returning the whole bundle? I mean, if I open my browser on That's the reasons I'm using Correct me if this is wrong, of course. |
No, webpack-dev-middleware in this case respect only for webpack assets |
I looked around Here's what I found: Issuing GET and HEAD to the root path
The same holds true for javascript files - I guess these are the kind of requests you were referring to when you said:
Next, I've checked the subpaths, which I expect will return the HTML of the base/main page: GET requests are still handled by
And even for requests to non-existent paths - which totally makes sense, because apart for the root path, subpaths only exists within the application, but there's no real HTML file corresponding to them:
And all of them return the same
But if I issue HEAD requests on those subpaths, differently from HEAD requests to
I still have to find where GET and HEAD take different routes to end up in those different replies. Any hint? Should I open an issue on |
I went a little further. I added some The request:
Arrives to
and then the flow falls to the line:
Afterwards, the
and then I see the If, though, the request is |
What do you want from |
I don't think so, I'm still trying to receive a reply to HEAD requests, which seem to be provided consistently when asking for javascript files, but not for the HTML of the base / index page. I can't tell whether this belongs to this repository or another of course, I need your help here: you already directed my over here from the issue I opened on webpack-dev-server and maybe this need to be moved elsewhere again. You then said in a prior post:
So I wanted to have a closer look at those replies I'm getting. To sum it up, it seems to me that HEAD requests for javascript files and for the base HTML page are all handled by |
Please provide small example, I can't understand your problem |
Sure, I'll do it. Meanwhile, may I kindly request this issue be reviewed by an additional person? No offence of course, but I'm not a native English speaker and maybe we're just misunderstanding each other a little. |
We don't have many contributors |
Ok. As a quick sample, this would replicate the behaviour:
Then
and
I made a small sample too, you can find it here: https://github.com/watery/head-req-webpack-test Those sources have been made following the Getting started guide, so they should be very basic. I started the dev-server with This was a good suggestion, as I discovered that in my small sample the issue doesn't show up:
and
Both return 404. So I checked twice the dev-server configuration in the two samples and found that is the I saw that webpack-dev-server configures the |
I see... Unfortunately, this problem does not seem to be solved. |
Well, the good news is that we finally found where the root of this issue is. I'm adding to the issue in that other repo to see if it can be sorted out; please leave this open for a little more, I'll update it when I get news. |
I'll keep this open until we solve the problem or mark it as won't fix |
Close in favor webpack/webpack-dev-server#2716 |
node:10.15.3-alpine
imageFeature Proposal
Make the dev-server reply to HEAD requests on resources where it already replies to GET requests; and add the
Last-Modified
response header if it's not already supported.Feature Use Case
I'm doing some experiments in a custom project that rely on
HEAD
requests and theLast-Modified
response header to detect a (React) app updated deploy. I'm already obtaining some results in a production build served by a full-featured webserver (nginx), and it would be nice to have here aswell, expecially in cases where the browser or page is closed and reopened between source code updates - which if I'm not mistaken, detaches the client code from the dev-server making the former lose the recompiled event that triggers a complete page reload.The latter is the case with
create-react-app
applications, that do not provide a debug build for deployment to staging servers (see Support for staging builds #790); thus running a dev-server instance on a staging server is the only option to let testers / non-developers to access the application for review.I actually noticed that a
HEAD
request returns 404 whereas a GET on the same resource returns 200, so maybe this is only a matter of supportingHEAD
requests too.I've been directed here from this issue of mine from the dev-server subproject. I think I copied over all the relevant information, but I'm linking it just in case.
The text was updated successfully, but these errors were encountered: