Skip to content
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

Missing packages should return HTTP 404 #556

Closed
Rufflewind opened this issue Feb 13, 2017 · 3 comments
Closed

Missing packages should return HTTP 404 #556

Rufflewind opened this issue Feb 13, 2017 · 3 comments
Labels
A-frontend 🐹 C-bug 🐞 Category: unintended, undesired behavior E-help-wanted

Comments

@Rufflewind
Copy link

If https://crates.io/crates/nonexistent_package does not refer to a valid package, it should respond with HTTP 404 to avoid misleading crawlers and/or browsers into thinking that it's a valid page.

@onur
Copy link
Member

onur commented Feb 13, 2017

It is responding 404:

$ curl -D- https://crates.io/crates/nonexistent_package
HTTP/1.1 404 Not Found
Connection: keep-alive
Server: nginx
Date: Mon, 13 Feb 2017 12:34:09 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 35
Set-Cookie: cargo_session=--3Mz45cH3itfVkmY41+nVjWRm9+0=; HttpOnly; Secure; Path=/
Via: 1.1 vegur

{"errors":[{"detail":"Not Found"}]}

@Rufflewind
Copy link
Author

@onur It seems to be dependent on the Accept header:

$ curl -v -H 'Accept: text/html' https://crates.io/crates/nonexistent_package
< …
< HTTP/1.1 200 OK
< …

@carols10cents carols10cents added A-frontend 🐹 A-ui E-help-wanted C-bug 🐞 Category: unintended, undesired behavior labels Feb 21, 2017
jtgeibel added a commit to jtgeibel/crates.io that referenced this issue Jul 25, 2019
The backend no longer checks for an "html" in the `Accept` header.
With the exception of 3 session related routes, all paths not starting
with "/api" will be redirected to the static Ember bootstrap page.

As a result of this change all non-api requests that don't contain
"html" in the `Accept` header will now unconditionally return `200`,
rather than `404`.  In a sense, this expands the scope of rust-lang#556 to all
requests, not just those that set the header.  It also inverts the
problem described in rust-lang#788, effectively turning it into a duplicate
of rust-lang#556.

Fixes: rust-lang#163
@carols10cents
Copy link
Member

Closing as a duplicate of #788.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend 🐹 C-bug 🐞 Category: unintended, undesired behavior E-help-wanted
Projects
None yet
Development

No branches or pull requests

4 participants