elm/elm-lang.org

Code snippet on Http always returns network error locally due to cors policy on elm-lang.org

aszenz opened this issue · 1 comments

The documentation at https://guide.elm-lang.org/effects/http.html refers to this code snippet:

init _ =
  ( Loading
  , Http.get
      { url = "https://elm-lang.org/assets/public-opinion.txt"
      , expect = Http.expectString GotText
      }
  )

which on running locally returns this cors error:

Access to XMLHttpRequest at 'https://elm-lang.org/assets/public-opinion.txt' from origin 'http://localhost:8000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://worker.elm-lang.org' that is not equal to the supplied origin.

2mol commented

Came here to open the same issue. It's not a great user experience, I can't even imagine how frustrating this would be for beginners who don't know how to check for CORS.

Can we please at least replace the URL in the docs with something like url = "https://httpbin.org/uuid"?