tycrek / ass

The simple self-hosted ShareX server
ISC License
655 stars 53 forks source link

[FEATURE] Handle /index.html route #144

Closed samip5 closed 2 years ago

samip5 commented 2 years ago

Description

It would be great if the app would handle requests to /index.html but still have the same logic like it currently does. This is for reverse-proxy workaround.

Akenndy commented 2 years ago

It would be great if the app would handle requests to /index.html but still have the same logic like it currently does. This is for reverse-proxy workaround.

tycrek commented 2 years ago

I'm not exactly sure this is worth it, all modern browsers handle / as the index just fine. Which reverse proxy has an issue? I know that Nginx and Caddy both work fine with /.

Closing for now; if there's a compelling reason to add this I'm open to hearing it.

samip5 commented 2 years ago

I'm not exactly sure this is worth it, all modern browsers handle / as the index just fine. Which reverse proxy has an issue? I know that Nginx and Caddy both work fine with /.

Closing for now; if there's a compelling reason to add this I'm open to hearing it.

Apache for example behaves weirdly while using mod_rewrite in proxy mode e.g:

RewriteEngine On
RewriteRule ^/?(.*)$ http://10.0.0.56:40106/$1 [P]
samip5 commented 2 years ago

That rewrite in my comment results in Apache always trying to request /index.html which of course doesn't work as it's not handled by the app but is the default index in Apache's configuration. This might need to be fixed in the rewrite rules rather than app though.

tycrek commented 2 years ago

Yeah that sounds like an Apache fix. I won't add a route myself but if you're up for editing source, you can add the below code to Line 107 in ass.ts

app.get('/index.html', (req, res, next) => res.sendStatus(201));