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

fetching a document which 401s #229

Closed
bblfish opened this issue Nov 5, 2015 · 3 comments
Closed

fetching a document which 401s #229

bblfish opened this issue Nov 5, 2015 · 3 comments

Comments

@bblfish
Copy link

bblfish commented Nov 5, 2015

I have a document served from localhost that calls a document https://joe.example:8443/2013/card on a different server that returns a 401 .

$ curl -k -i https://joe.example:8443/2013/card
HTTP/1.1 401 Unauthorized
Access-Control-Allow-Origin: *
Content-Type: text/html; charset=utf-8
WWW-Authenticate: Signature realm="/"
Content-Length: 2374
...

Currently in Chrome 48.0.2554.0 canary (64-bit) this shows up as The FetchEvent for "https://joe.example:8443/2013/card" resulted in a network error response: the promise was rejected.
If the same file were served by localhost on a different port it would be accessible.

So this seems to be a CORS problem. I am not sure if the spec allows me to capture 401s or not. I have I think set { mode: "cors", credentials: "omit" } ( I say I think because I am working from scala-js and am not yet that familiar with it. The console shows the following:

screen shot 2015-11-05 at 00 10 24

It is not so clear from the fetch documentation what the different modes actually mean. Should I be able to find the 401? I'd like to be able to work out what authentication I can use on the future requests.

It could also be that I my RequestInit datastructure is incorrect. But as I don't yet know what to expect it is difficult to work out what may be wrong.

@dgraham
Copy link
Contributor

dgraham commented Nov 5, 2015

@dgraham dgraham closed this as completed Nov 5, 2015
@bblfish
Copy link
Author

bblfish commented Nov 5, 2015

thanks @dgraham . I made the following mistake:

  • I have a server running locally under https://joe.example:8443 which I can access after editing /etc/hosts , but the certificate my server was running had a CN=localhost. I created a new certificate with CN=joe.example and that helped

It may be worth closing such issues but tagging them "howto" so that people writing more general public documentation can look through these questions and write HOWTOs with the answers given.

@bblfish
Copy link
Author

bblfish commented Nov 5, 2015

Duh. I also thought this was the whatwg fetch github.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants