Stellarium / stellarium-web-engine

JavaScript planetarium engine
405 stars 83 forks source link

Localhost CORS error #180

Open weaklysubjective opened 1 year ago

weaklysubjective commented 1 year ago

Hi,

Thank you for the wonderful software. Been testing the webengine and had no trouble following the instructions :

weaklysubjective commented 1 year ago

oops hit submit too soon : As i was saying , i had no trouble following the instructions i.e. : # Setup emscripten path. source $PATH_TO_EMSDK/emsdk_env.sh

Build stellarium-web-engine.js and stellarium-web-engine.wasm

This will also copy the files into html/static/js

make js

Now see apps/simple-html/ to try the library in a browser. . However after the page loaded some of the config settings, like the menu settings, tooltips etc do not seem to load. This is because when running from localhost, it runs into CORS Access issue where the backend stellarium link is not loaded : backend: {

  loadPath: 'https://stellarium.sfo2.cdn.digitaloceanspaces.com/' +
            'i18n/v1/{{ns}}/{{lng}}.json'
}

Any clues how to solve this ? Thanks

weaklysubjective commented 1 year ago

I found issues #35 and #85 relating to CORS. You suggested use of localhost:8080, and I made sure to run the server using localhost and port 8080. The CORS errors is gone (reading from console), but access is forbidden (403) for this part of the html ---> // Setup i18next for translations. i18next.use(i18nextXHRBackend).init({ lng: 'en', ns: ['gui', 'skyculture'], debug: false, backend: { loadPath: 'https://stellarium.sfo2.cdn.digitaloceanspaces.com/' + 'i18n/v1/{{ns}}/{{lng}}.json' } }); . Any suggestions ?