audreyt / ethercalc

Node.js port of Multi-user SocialCalc
https://ethercalc.net
Other
2.96k stars 537 forks source link

Export/Downloads "Cannot GET ..." - 404 error #360

Open rugk opened 8 years ago

rugk commented 8 years ago

The exports do not work. No matter whether I choose CSV, HTML or Excel.

It tries to access this URL CustomSubDir/rzkr7lp08r/rzkr7lp08r.html, but it returns a 404 error:

Cannot GET /rzkr7lp08r/rzkr7lp08r.html

This is clearly an error from NodeJS, not from nginx, which I use as a reverse proxy.

eddyparkinson commented 8 years ago

looks related to #340 CustomSubDir/rzkr7lp08r.html would be more normal

rugk commented 8 years ago

Indeed it looks related, but of course it cannot be solved in some kind of Sandstorm way. I'll look into my nginx config whether it is wrong or whether I can at least provide a workaround.

rugk commented 8 years ago

BTW the same happens with these files. They are requested from the wrong location:

/CustomSubDir/90zlpiv1at/images/sc_more-hn.gif
/CustomSubDir/90zlpiv1at/images/sc_more-vh.gif
/CustomSubDir/90zlpiv1at/images/sc_more-vn.gif
/CustomSubDir/90zlpiv1at/images/sc_range2.gif
/CustomSubDir/90zlpiv1at/images/sc_cursorinsertup.gif

Note that I use --basepath /CustomSubDir.

rugk commented 8 years ago

I assume it is the fault of Etherpad, which returns some wrong URLs. (May only happen in a subdirectory installation)

So this is a workaround for the export bug:

# workaround for export bug: https://github.com/audreyt/ethercalc/issues/360
location ~ /CustomSubDir/(.*)/(.*)\.(csv|html|xlsx)$ {
    rewrite /CustomSubDir/(.*)/(.*)\.(csv|html|xlsx)$ /CustomSubDir/$1.$3 redirect;
}

https://regex101.com/r/sH4lX4/1

And this is a workaround for the image files:

# workaround for image bug: https://github.com/audreyt/ethercalc/issues/360
location ~ ^/CustomSubDir/(.*)/(images)/(.*) {
    rewrite /CustomSubDir/(.*)/(images)/(.*) /CustomSubDir/$2/$3 permanent;
}

https://regex101.com/r/qW6uJ9/2

Still note: This are workarounds! I do not recommend using them in production, but rather recommend to fix the issue with wrong file paths requested. (might be just a missing ./ or ../ in the part where these file paths are set)

poVoq commented 6 years ago

Did you check this again? For me it seems to work. Maybe this was fixed in Etherpad?

My setup seems very similar to yours.

rugk commented 6 years ago

Did not check again.