hrgdavor / jscadui

MIT License
30 stars 9 forks source link

jscad.app fantasizes design for non-existing URL #84

Closed Hermann-SW closed 9 months ago

Hermann-SW commented 9 months ago

I worked on Raspberry Pi5 before, switched to Linux on x86_64 laptop.

This file does not exist: https://stamm-wilbrandt.de/en/forum/C36_10.correct.jscad

Proof on server:

$ ssh web23.web138@stamm-wilbrandt.de
web23.web138@stamm-wilbrandt.de's password: 
Last failed login: Fri Jan 19 11:44:51 CET 2024 from ip-109-193-006-010.um39.pools.vodafone-ip.de on ssh:notty
There was 1 failed login attempt since the last successful login.
-chrootsh-4.2$ ls -l httpdocs/forum/en/C36_10*
ls: cannot access httpdocs/forum/en/C36_10*: No such file or directory
-chrootsh-4.2$ 

openjscad.xyz errors out as it should: https://openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/C36_10.correct.jscad

jscad.app shows a model for that URL: https://jscad.app/#https://stamm-wilbrandt.de/en/forum/C36_10.correct.jscad

The model displayed is one I created, but not under that name. New OS, new browser (chrome this time), so it cannot be a problem of local browser cache.

Does jscad.app fantasize? If so, can that be turned off please?

hrgdavor commented 9 months ago

@Hermann-SW best solution would be to setup CORS headers, so jscad.app can run them by using browser download.

Since you do not have correct CORS headers, jscad.app uses fallback proxy, that is hosted on some cloud provider. There is obviously some heavy caching in that cloud service.

@platypii could you look into it ?

Hermann-SW commented 9 months ago

@hrgdavor Thanks, I tested with this new gist and curl: https://gist.github.com/Hermann-SW/ef1ceade4aa53412585e42b6c5122354

Different to one of your previous postings on CORS https://github.com/jscad/OpenJSCAD.org/issues/1318#issuecomment-1896152731

only one "*allow*" header is returned by the raw gist (access-control-allow-origin: *).

hrgdavor commented 9 months ago

@Hermann-SW cache is now turned off for the proxy script by @platypii . Try again, I did, and now it shows error correctl, instead of old cached file. This will also be useful if file changes from time to time, so ppl get fresh version.

hrgdavor commented 9 months ago

only one "allow" header is returned by the raw gist (access-control-allow-origin: *).

there is a special pre-flight request that browser is not showing you. And also I copied .htaccess example from somewhere, and it worked for me. I did not try to minimize it.

Hermann-SW commented 9 months ago

@hrgdavor Thanks, same here, jscad.app now reports:

Error: failed to load script from url https://stamm-wilbrandt.de/en/forum/C36_10.correct.jscad
Hermann-SW commented 9 months ago

Just one last comment, I experimented with gist and cache control. To reference latest version, no commit hash should be in URL: https://gist.github.com/Hermann-SW/ef1ceade4aa53412585e42b6c5122354?permalink_comment_id=4841174#gistcomment-4841174

max-age=300 for raw gist cannot be lowered. So workflow to publish JSCAD gist is:

  1. publish change
  2. wait 5min
  3. post somewhere mentioning the URL, and everyone is guaranteed to see latest version

More details: https://gist.github.com/Hermann-SW/ef1ceade4aa53412585e42b6c5122354?permalink_comment_id=4841245#gistcomment-4841245

hrgdavor commented 9 months ago

@Hermann-SW thank you for the research, and the insights, I will add those findings somewhere in readme for others to see