Welcome! Log In Create A New Profile

Advanced

How to correctly include javascripts and online ressources/packages to html site for non CORS Nginx server domain?

Posted by draude94 
Hi!

I made a web page that displays a ldr model using ThreeJS.
I used nodeJS with express for backend. But since my domain does not support nodeJS but Nginx, I needed to make some changes.

The javascript (main.js) does not seem to work anymore, since my dropdown is not populated by it.
(Files are there, paths should be ok, since it worked perfectly with nodeJS)

Could there be a problem because CORS is disabled? (I was also using a CORS package with nodeJS)

Html Code is attached (bots.html).
Javascript file is attached (main.js).

Here are the general domain details:
'''
$ curl -I https://https://legolab.mmv-itc.de
HTTP/2 200
server: nginx
date: Tue, 24 Oct 2023 10:48:06 GMT
content-type: text/html
content-length: 2763
vary: Accept-Encoding
x-accel-version: 0.01
last-modified: Tue, 24 Oct 2023 10:44:24 GMT
etag: "acb-6087405a3ebe2"
accept-ranges: bytes
vary: Accept-Encoding
'''

And here is the web dev console log I get:
'''
Uncaught Error: fetch for "https://legolab.mmv-itc.de/views/models/ldraw/officialLibrary/LDCfgalt.ldr" responded with 500:
HttpError https://unpkg.com/three@0.157.0/build/three.module.js:41944
load https://unpkg.com/three@0.157.0/build/three.module.js:42097
three.module.js:41944:3
HttpError https://unpkg.com/three@0.157.0/build/three.module.js:41944
load https://unpkg.com/three@0.157.0/build/three.module.js:42097
Error fetching model list: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data main.js:103:13
fetchModelList https://legolab.mmv-itc.de/views/main.js:103
'''

Note: The path to the LDCfgalt.ldr file is valid and the file is also existing and valid.



Edited 2 time(s). Last edit at 10/24/2023 06:56AM by draude94.
Attachments:
open | download - main.js (6.5 KB)
open | download - bots.html (4.3 KB)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 285
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready