fairDataSociety / fairdrive-theapp

The main app to browse Fairdrive.
GNU General Public License v3.0
21 stars 7 forks source link

err403 after reloading .dev drive #491

Closed tamas6 closed 6 months ago

tamas6 commented 1 year ago

related to #234 probably.

url remains: https://app.fairdrive.dev.fairdatasociety.org/overview/

IgorShadurin commented 1 year ago

Confirm. -Login to https://app.fairdrive.dev.fairdatasociety.org/ -Reload the page, get error

Screenshot 2023-09-08 at 15 29 05
tamas6 commented 1 year ago

https://github.com/fairDataSociety/fairdrive-theapp/assets/81620050/55aec772-49dc-4e75-8e01-956e6dfe3b95

NEW case. After this, simple delete the /overview/ part of the url simulating -redirecting to login page- This happened. Spooky

darkobas2 commented 1 year ago

There is no /overview/ in static... that shows in url works only because of js router in index so if you reload it wants to load /overview/index.xx which doesnt exist

IgorShadurin commented 1 year ago

There is no /overview/ in static... that shows in url works only because of js router in index so if you reload it wants to load /overview/index.xx which doesnt exist

I mean we need to configure Nginx like this:

server {
    location / {
        try_files $uri $uri/ /index.html;
    }
}

Can we do this?

darkobas2 commented 1 year ago

This is exactly what we have https://github.com/fairDataSociety/fairdrive-theapp/blob/e1c8c124cbba388567c991bb956ec6763768e693/Dockerfile#L83

$uri is a variable that contains overview in our example case. If you look in static export there is no overview file, no overview folder so that can not work. You have to change source code so that these pages are generated.

https://nextjs.org/docs/pages/building-your-application/deploying/static-exports

IgorShadurin commented 1 year ago

This is exactly what we have

https://github.com/fairDataSociety/fairdrive-theapp/blob/e1c8c124cbba388567c991bb956ec6763768e693/Dockerfile#L83

$uri is a variable that contains overview in our example case. If you look in static export there is no overview file, no overview folder so that can not work. You have to change source code so that these pages are generated.

https://nextjs.org/docs/pages/building-your-application/deploying/static-exports

I looked at the build in the out directory. It has an overview directory, but there is no index.html in it.

Using the link you provided, what can I do to make sure everything works as it should?

I configured something similar for Apache, but nginx may require some additional configuration. The main goal is for all unfound routes to be processed by index.html

Example for Apache

<Directory /var/www/html>
                 Options Indexes FollowSymLinks
                 AllowOverride All
                 Require all granted

                 RewriteEngine on
                 # If the requested resource is a file (but not directory), go to it as it is
                 RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f
                 RewriteRule ^ - [L]
                 # For other cases (including if the directory exists but doesn't contain an index.html), use index.html
                 RewriteRule^/index.html

</Directory>
darkobas2 commented 1 year ago

If overview folder exists and its empty explains why we get 403 and not 404 or index.html.

If we remove "$uri/" that will fix the 403.

We shouldnt have an empty folder produced by static export build

What ever we hack in web server the following issues will persist:

IgorShadurin commented 1 year ago
  • on reload you always get login page even if you have just logged in.

In any case, after reloading the page, the login is reset and you need to log in again

darkobas2 commented 1 year ago
  • on reload you always get login page even if you have just logged in.

In any case, after reloading the page, the login is reset and you need to log in again

Dunno if we declare that a feature or a "bug"

tamas6 commented 1 year ago

I’d prioritise this, stale issue for 3 weeks now