rejetto / hfs

HFS is a web file server to run on your computer. Share folders or even a single file thanks to the virtual file system.
GNU General Public License v3.0
2.29k stars 227 forks source link

User authentication failure when page refresh(0.46.0) #283

Closed KJH-x closed 1 year ago

KJH-x commented 1 year ago

To Reproduce Not sure if it would happen in other machine

  1. (User Interface) login
  2. click on any folder that this account is allowed to list
  3. the page require user to login again
  4. repeat step 1, 2 for subfolders and 3 still exists

Describe the bug After Updated to 0.46.0 by overwriting old excutable and plugins, this problem came up. Before I meet with this problem, the rootpage of user interface access is changed to no one. I set it to anyone and found the issue as described above. When I try to find if its a problem of my settings, I refreshed the front-end using F5 and found the login status was cleared. That's the reason I write the title of this issue. Also when I accessing subfolders of folder from disk(logged in), a tooltip pops up saying Account xxx has no access, try another. At this time, whatever account I tried, I kept receiving error warnings. What's the fact that if I directly type the right URI, I can access it with the same account.

Expected behavior Expeted to work as before, login once and access folders and files normally.

Screenshots If necessary, I will provide it in the following discussion.

Environment (please complete the following information):

rejetto commented 1 year ago

so, you login, it seems it worked, then as you refresh you are not logged in anymore. Correct?

If you confirm, then your problem is that the cookie is not saved. The rest is just a consequence.

KJH-x commented 1 year ago

Sorry for the late reply. Yes, I'm sure it's a cookie issue, and I'm having this issue in all devices. So it's most likely a server issue. I've restarted the program and changed some settings, but it doesn't work.

I'm also confused with this condition, which doesn't look like a cookie issue:

Also when I accessing subfolders of folder from disk(logged in), a tooltip pops up saying Account xxx has no access, try another. At this time, whatever account I tried, I kept receiving error warnings. What's the fact that if I directly type the right URI, I can access it with the same account.

rejetto commented 1 year ago

I'm also confused with this condition, which doesn't look like a cookie issue:

for me this can also be the cookie. I expected it to be a problem with your browser, but you say it's all devices, so, I don't know why you are having this problem. The only way that I can think of to help you is: write to me privately with an access to your server, so I can see the problem happening and study it. Of course you don't need to give me access to your files: create an account for me with access only to an empty virtual folder. To not disclose the address of your server you can write privately to a@rejetto.com

rejetto commented 1 year ago

ok, we've found that it something to do with nginx as reverse proxy. Be sure to follow these instructions https://github.com/rejetto/hfs/wiki/Reverse-proxy

and let me know if the problem is solved

KJH-x commented 1 year ago

Thanks very much with your instructions and sorry for my carelessness 😢

rejetto commented 1 year ago

don't worry. Did HFS in the admin-panel tell you there was a proxy?

KJH-x commented 1 year ago

No, I only saw these:

image image
rejetto commented 1 year ago

ok, right. Because the proxy was not fully configured, HFS didn't detect it. If I find a way to detect it, I could suggest the user to read the guide. I'm going to have another look at it.

rejetto commented 1 year ago

ok, I just tested my nginx, which is configured as described in the guide, and login works: refresh and I'm still in. So, I hope that you will solve by adjusting your nginx configuration.

rejetto commented 1 year ago

doing more testing, sometimes it works, sometimes it doesn't (with nginx). I still didn't understand why. I'll let you know if I succeed.

rejetto commented 1 year ago

false alarm: my tests failed because of a bug restricted to localhost, so I'd exclude it is what you have. You can try updating to 0.46.1 and see if anything changes, but I wouldn't put much hope. You can do it easily with the new update button

image

If I had your non-working nginx I could make more tests to understand the problem.

rejetto commented 1 year ago

I will close this as we now know that it is not HFS, but you can comment more if anything new comes up