Closed nosy-b closed 6 years ago
I'm quite suprised: it does work on a distant env: www.itowns-project.org (see globe example, it uses some of these json files). I suspect there's something wrong with your environment. How do you serve your files?
Yes I was surprised it works on Github.io but not on my server I don't have the hand on it, there is Apache/2.2.16 (Debian) on it that's all the info I have
Are you just dropping the files somewhere, or are you using npm start
?
Ok I know why I have to specify same origin credentials for the fetch! That's because the access to the directory is protected with an indentificaiton. If I place the project on an 'open' directory it works fine without fetch parametrization.
When trying to copy the whole itowns repository with its build on a server the JSON files can't be loaded because of Authorization Required 401
Your Environment
Win7/Chrome
Context
It works fine in localhost but when deploying on a standard distant server it can't get the JSON from examples
FIX
An easy fix is to add fetch parameters :
{headers: {Accept: 'application/json'}, credentials: 'same-origin'}
Example to load the ortho JSON from Examples
Should we add this as default option in the Fetcher class or modify all examples with this default parameters so users don't have bad surprises when deploying iTowns on their servers?