# Http.get Request Chronically Failing

**URL:** <https://discourse.elm-lang.org/t/http-get-request-chronically-failing/4548>\
**Category:** Learn\
**Created:** [October 24, 2019, 7:20pm UTC](https://discourse.elm-lang.org/t/http-get-request-chronically-failing/4548 "2019-10-24T19:20:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbohanon](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@jbohanon](https://discourse.elm-lang.org/u/jbohanon)\
**Post date:** [October 24, 2019, 7:20pm UTC](https://discourse.elm-lang.org/t/http-get-request-chronically-failing/4548/1 "2019-10-24T19:20:42Z")

</div>

Hello,

I am working through the tutorial examples, and when trying the book example from the Http section, I’m running into a snag. It works fine in the online emulator, but when I put it in atom and run it through reactor, I’m getting a NetworkError response. This was somewhat fortunate at first as it helped me learn about the response types and handling them, but now I can’t seem to work it out. I’ve tried it with different .txt URLs, and tried it on different networks (work network and mobile). The link to my modified code is above, although it produces the same result when copied straight out of the tutorial. Am I missing an import or some other structural/syntactical oversight?

[https://ellie-app.com/72cm5dWfjPva1](https://ellie-app.com/72cm5dWfjPva1)

Thanks,  
Jacob

---

<div class="post-metadata">

**Author:** ![berend](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/berend/32/2250_2.png) [@berend](https://discourse.elm-lang.org/u/berend)\
**Post date:** [October 24, 2019, 7:32pm UTC](https://discourse.elm-lang.org/t/http-get-request-chronically-failing/4548/2 "2019-10-24T19:32:58Z")

</div>

Do you know how to use your browser’s debugging console? Press F12. You will then see this mesage:

Access to XMLHttpRequest at ‘[https://elm-lang.org/assets/public-opinion.txt](https://elm-lang.org/assets/public-opinion.txt)’ from origin ‘[https://ellie-app.com](https://ellie-app.com)’ has been blocked by CORS policy: The ‘Access-Control-Allow-Origin’ header has a value ‘[https://worker.elm-lang.org](https://worker.elm-lang.org)’ that is not equal to the supplied origin.

---

<div class="post-metadata">

**Author:** ![jbohanon](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@jbohanon](https://discourse.elm-lang.org/u/jbohanon)\
**Post date:** [October 24, 2019, 8:03pm UTC](https://discourse.elm-lang.org/t/http-get-request-chronically-failing/4548/3 "2019-10-24T20:03:08Z")

</div>

Okay, thank you!! I pushed it through a generic CORS proxy I found on SO and it worked. I’m new to web development (_very new_) so this may be a silly question, but are these CORS denials common? Is it even advisable to use a CORS proxy?

Why does the browser not block the http request if I navigate there directly with the address bar?

Thank you

---

<div class="post-metadata">

**Author:** ![malaire](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@malaire](https://discourse.elm-lang.org/u/malaire)\
**Post date:** [October 24, 2019, 8:04pm UTC](https://discourse.elm-lang.org/t/http-get-request-chronically-failing/4548/4 "2019-10-24T20:04:00Z")

</div>

Your code itself is working correctly, it’s just that the [elm-lang.org](http://elm-lang.org) server doesn’t allow you to fetch that file.

Try changing your URL to e.g. `https://www.markuslaire.com/ajax/TimeNowUTC.php` which allows access to see that your code does actually work.

---

<div class="post-metadata">

**Author:** ![malaire](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@malaire](https://discourse.elm-lang.org/u/malaire)\
**Post date:** [October 24, 2019, 8:05pm UTC](https://discourse.elm-lang.org/t/http-get-request-chronically-failing/4548/5 "2019-10-24T20:05:24Z")

</div>

> [@jbohanon](#):
>
> Why does the browser not block the http request if I navigate there directly with the address bar?

When accessing that file directly, CORS restrictions are not applied. They are only applied when you access file through JavaScript.

> [@jbohanon](#):
>
> are these CORS denials common

By default CORS access is not allowed. Server must specifically send `Access-Control-Allow-Origin` header to allow access, so denials are really common.

---

<div class="post-metadata">

**Author:** ![jbohanon](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@jbohanon](https://discourse.elm-lang.org/u/jbohanon)\
**Post date:** [October 24, 2019, 8:46pm UTC](https://discourse.elm-lang.org/t/http-get-request-chronically-failing/4548/6 "2019-10-24T20:46:31Z")

</div>

Thanks for the input. I will keep a lookout for this sort of configuration error in future get requests.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [November 3, 2019, 8:46pm UTC](https://discourse.elm-lang.org/t/http-get-request-chronically-failing/4548/7 "2019-11-03T20:46:43Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
