stellarium-web-engine icon indicating copy to clipboard operation
stellarium-web-engine copied to clipboard

Localhost CORS error

Open weaklysubjective opened this issue 3 years ago • 2 comments

Hi,

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

weaklysubjective avatar Mar 27 '23 15:03 weaklysubjective

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 avatar Mar 27 '23 15:03 weaklysubjective

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 ?

weaklysubjective avatar Mar 27 '23 15:03 weaklysubjective