rejetto forum

Software => HFS ~ HTTP File Server => Bug reports => Topic started by: Dave987 on October 19, 2015, 01:27:32 PM

Title: Server returns 301 for a valid directory
Post by: Dave987 on October 19, 2015, 01:27:32 PM
I've been having a bit of an odd problem which may or may not be a bug.

On my server, I have a few webpages in the root, then a folder called "files".  The first few times each day when I browse to /files, however, I get "301 - Moved permanently to /files/"
If I click the "/files/" link, it "redirects" me to the same exact URL, which opens the page.
Here is a screenshot of this: http://i1090.photobucket.com/albums/i373/fun4youall/HFS_zps8frvamye.jpg (it's also attached)

Does anyone know why this might be happening?
Thanks!
Title: Re: Server returns 301 for a valid directory
Post by: Mars on October 19, 2015, 01:59:26 PM
You are using hfs 2.3f

upgrade to 2.3g or use the same with bug account corrected in my message
http://www.rejetto.com/forum/bug-reports/account-names/msg1060744/#msg1060744
it's equivalent version as rejetto with lower size by compressed with upx


question ; have you a redirect macro in your template or redirect url in some accounts ,  301 message can appear generaly in this case

I suppose that's your hfs server?
Quote
Quack, Quack

Unless you have webbed feet and a bill for a mouth, this site isn't for you.

If you already have an account, Click here. Don't have one?

 David    folder   10/14/2015 1:02:59 PM   6
Games    folder   10/1/2015 6:44:24 PM   2
Installers    folder   10/16/2015 7:16:00 PM   0
Johnny    folder   9/30/2015 12:06:02 PM   0
Portable    folder   10/12/2015 4:39:54 PM   0
Public    folder   9/30/2015 12:07:42 PM   0
Testing    folder   9/30/2015 12:04:42 PM   0
Title: Re: Server returns 301 for a valid directory
Post by: Dave987 on October 19, 2015, 02:13:52 PM
Yes, I'm going to try g, but I have not gotten to do so yet.
The redirect option for user accounts didn't seem to be working, so I have the user try to open a protected "login" page, so they must log in. Once they log in, that page loads, and a 5-second delayed redirect takes over.  There is also a simple anchor tag link, if the user doesn't want to wait.  Either redirect takes them to /files.

Note that this is an experimental/proof on concept server, so not everything is set up in an ideal fashion for public use.

Thanks for the prompt response!

I hope this isn't a duplicate post.  I'm having a little trouble with your website.
Title: Re: Server returns 301 for a valid directory
Post by: Mars on October 19, 2015, 02:31:08 PM
if you use a link to redirect logged users, you have to end url with a "/" for folders

http:// xxx.xxx.xxx.xxx/files/

under /files/ create a temporaly protected folder to a new user "test" with "test" as password , i will see if by clicking you link i can reproduce
Title: Re: Server returns 301 for a valid directory
Post by: Dave987 on October 20, 2015, 12:05:03 AM
I believe I did use a "/" at the end.  If you look at the screenshot, that is what is in the address bar.
I added that user and pass to the main system, so you have a better chance of getting the same error.  You have access to home, login, and files, but not the sub-directories.

Thanks for your help!
Title: Re: Server returns 301 for a valid directory
Post by: Mars on October 20, 2015, 09:30:16 AM
at first connection , after login  redirected perfectly to /files/

no error under Firefox and Chome

for me , all is right
Title: Re: Server returns 301 for a valid directory
Post by: Dave987 on October 20, 2015, 01:37:40 PM
It works fine for me about 70% of the time.  If it works, it will continue to for some time.  When it doesn't work is when I am connecting to it after not using it for some time.  I do not expect it.
Title: Re: Server returns 301 for a valid directory
Post by: bmartino1 on October 20, 2015, 08:32:57 PM
dave, when you connect to it, are you on the same computer as the HFS program / site?
Title: Re: Server returns 301 for a valid directory
Post by: Dave987 on October 20, 2015, 08:55:04 PM
I am never on the same computer--it runs from a dedicated server computer.  However, I am sometimes connecting from the LAN to the external IP, which sends me back into the LAN.
However, this happens from outside networks as well.  Another user reported the problem to me from his, and I have seen this myself.  The screenshot I provided was actually from another network, as well.

I am beginning to suspect that it is more likely to happen after restarting the server.  My next restart is scheduled for Wednesday, when I upgrade to subversion G.  Perhaps we will see then?
Title: Re: Server returns 301 for a valid directory
Post by: bmartino1 on October 21, 2015, 07:50:11 PM
alright, thank you for confirming that it not just a local network causing this error as that can be a cause for this..., my next question is, are you using HFS default template, or did you load a template or use the different template tab for this folder?

What i'm trying to get at is when you click on the link it takes you to this error, where where you be fore this page?
Title: Re: Server returns 301 for a valid directory
Post by: Dave987 on October 22, 2015, 01:39:40 PM
I am using the default template, but I have added two simple pages.  These are files, not custom code entered into the server.  When I get the error, am coming from a custom webpage, called login.

I touched on this before, but to be clear, it works something like this:
When you browse to the root, you will be shown an "index.html" file.  That file links to a protected page called login.  The user must log in to see that page, so the page itself thanks the user for logging in, and auto-redirects on delay to /files.  The user can also click a go now link.
It is at this jump from custom pages in the root to the subfolder /files, which opens the default page (file browser) that I am given a 301.


*Note: I said the server would update yesterday to version G, but something went wrong, and it didn't happen.  I will need to do it manually.  For now, I am still on F.*
Title: Re: Server returns 301 for a valid directory
Post by: bmartino1 on October 22, 2015, 09:59:14 PM
Ok, honestly, this sounds like a permissions issue to access the folder.

Possible permission issues:
HFS to windows file permission read/write?
user account error to aces file
? everyone over access
etc, it was just a thought, i don't think it is the issue...
Title: Re: Server returns 301 for a valid directory
Post by: Dave987 on October 26, 2015, 01:41:58 PM
Thanks for posting!
Permissions issue, as in, the users don't have access to that folder?  If so, then why does clicking on the redirect link work just fine?  Other times, browsing directly there works, too.  It's an interesting idea, but I'm not sure how that would be the case.  Care to elaborate?
Thanks again!
Title: Re: Server returns 301 for a valid directory
Post by: Dave987 on October 27, 2015, 01:54:37 PM
I've finally updated to 2.3g.  We'll see if this works. If not.... :o
Title: Re: Server returns 301 for a valid directory
Post by: Mars on October 27, 2015, 05:22:18 PM
despite attempts to connect to your server, I still have not managed to implement this error 301, I remember in ancient times that this problem had already arrived but had been resolved by the application of a fix, so your current problem is quite incomprehensible
Title: Re: Server returns 301 for a valid directory
Post by: Dave987 on October 27, 2015, 08:07:03 PM
Well, thank you for continuing to try, Mars!  I thought it odd as well, although I still don't know nearly as much as you about this.  Intermittent problems are the worst! 
By the way, I wasn't paying close attention, but it seems that most, if not all of the times  received the error, I was using IE.  I also use Firefox and Opera (12.16), however, so it might have happened on these as well.  I wouldn't think a 200 packet, or anything else could be mistaken for a 301, but I suppose it might be something to keep in the back of our minds.
Title: Re: Server returns 301 for a valid directory
Post by: Dave987 on March 18, 2016, 10:45:33 PM
Well, I'm back to getting this problem from time to time.
It's happened to me a couple times now, right when a web page passes be off the the default file management system.  I don't know what more info I can add other than that I'm using Firefox this time. Again, though,I really see no way the browser could cause the issue.
Title: Re: Server returns 301 for a valid directory
Post by: bmartino1 on March 19, 2016, 04:22:30 AM
i doubt it, but this could be caused by the HFS Cookie session ID...
Title: Re: Server returns 301 for a valid directory
Post by: Dave987 on March 19, 2016, 05:44:33 AM
i doubt it, but this could be caused by the HFS Cookie session ID...

I'm afraid I don't know what the Cookie session ID even is. You could be right, but how could I find out?  Sorry, I'm still leaning some of the basics here.
Title: Re: Server returns 301 for a valid directory
Post by: bmartino1 on March 19, 2016, 02:24:35 PM
http://www.rejetto.com/forum/html-templates/troubleshooting-hfs-cookie-issues-on-rename-in-the-default-template/

a cookie is created by the browser once it is coneted to the HFS site, there have beeen some problem with teh template doing things liek the post above. in that post, the user SKB, was having problems renaming a file, and it turened out to be a bad cokkie.

The cokie in HFS, generates a session ID, in whcih for password protected items can be a cause for links and access to folder paths.

right click the house "/" and go to properties > different tempalt tab, ad this to the info:

data.token = getCookie('HFS_SID');

this lin once going to the home page or "/" will show a sting number, that is your session ID.

Because the cookie can be used in how the fiel is accessed, i belive the cookie can be casueing a problem. It is also very unlilkey as one of the admins "Mars" has been tyring to repoduce your issue, but not having much luck in fidning the error.

i'd have to go looking fo r it, but there was a "fix" for the cokkie generation in wicth the template would "reset and delete it and recreate the cokkie....

BUT, that is IF the 301 error is coming form the cokkie. I hvae yet to see a 301 on HFS.
Title: Re: Server returns 301 for a valid directory
Post by: Dave987 on March 19, 2016, 10:15:42 PM
I knew the basics of cookies, but not specifically about the ID, so it's good to know--thanks!
It's good to know how to get the session ID, but once I do, what do I do with it? How can I tell if it's bad?

I know Mars really did try to find the issue with this before, and I appreciated it!  Once I updated last time from F to G, the problem did vanish for a while...then it came back.

I don't want to openly post my IP, but if Mars or another SysOp is trying to connect, it is hosting from this IP on port 8888.
Title: Re: Server returns 301 for a valid directory
Post by: rejetto on March 23, 2016, 11:26:31 PM
i wouldn't mind the cookie.
I think it may be just your IE version. Can't you restrict your problem to a specific browser version, by testing?

HFS should send that page only when a folder is requested without the trailing /

Code: [Select]
if f.isFolder() and not ansiEndsStr('/',url) then
    begin
    conn.reply.mode:=HRM_MOVED;

I suspect that browser is automatically removing the / for some strange reason.
Title: Re: Server returns 301 for a valid directory
Post by: Dave987 on April 08, 2016, 04:46:06 AM
I experienced this problem is IE 9, Firefox 43.x.x.x and Opera 12.16.
The most recent time I experienced this might actually have been my own stupidity.  I had changed some HTML code, and left out a "/" on one link.  I fixed this, and so far it's been working alright.  However, this could have been the issue only this once.  Before I'm pretty sure it was something else.

I guess we can call this one "resolved" for now anyway.
Title: Re: Server returns 301 for a valid directory
Post by: Fysack on September 30, 2017, 11:21:39 PM
 ;D ;D ;D ;D ;D Mars, yea, no,  .. it nnnooot f n y  ;D ;D ;D