rejetto forum

Software => HFS ~ HTTP File Server => Bug reports => Topic started by: chris.zeman on February 05, 2007, 05:29:55 PM

Title: HFS Icons through an Apache Reverse Proxy
Post by: chris.zeman on February 05, 2007, 05:29:55 PM
HFS has proven to be an extremely valuable tool in our organization. Great job, rejetto! I am, unfortunately, having one problem.

I have a Linux server acting as an internet gateway for our LAN, and a general purpose web server. HFS is running on another employee's machine on our LAN. It's a long story, but both machines MUST be able to serve pages on port 80, so I can't simply forward port 80 to HFS. I configured Apache to act as a reverse proxy for the computer running HFS, assigning a sub-domain to the HFS macine. I can connect to HFS from the internet, upload and download files, but HFS's icons aren't being displayed.

I am sure this is a configuration problem with Apache, but figured this forum would be the best place to start. I just need something to go on.

Thank you,
Chris
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on February 06, 2007, 02:41:04 AM
what icons?
you mean the icons aside the file names on the browser?
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: chris.zeman on February 06, 2007, 11:42:13 PM
Yes. Actually, pretty much any image. Here is a screenshot:

(http://smartautomation.com/HFS%20Screenshot.JPG)


Thank you,
Chris
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on February 07, 2007, 06:54:06 AM
check the "max connections" and "max connections from single address" options.
they should not be used, and can cause such problem.

if this is not the case, try posting the content of menu -> other options -> show customized options
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: chris.zeman on February 12, 2007, 01:48:09 PM
Those options were all disabled. Here are the customized options:

Code: [Select]
easy=no
default: yes

tpl-font=Tahoma|10|clBlack|
default: Tahoma|10|clWindowText|

log-file-name=C:\Log.txt
default:

log-date=yes
default: no

log-replies=no
default: yes

confirm-exit=yes
default: no

search-better-ip=no
default: yes

start-minimized=yes
default: no

files-stay-flagged-for-minutes=1000
default: 0

auto-save-vfs=yes
default: no

use-comment-as-realm=no
default: yes

beep-on-flash=yes
default: no

list-protected-items=yes
default: no

auto-save-vfs-every=6000
default: 0

auto-save-cfg-every=6000
default: 0

flash-on=connection
default: download

last-file-open=C:\My Documents\HFS.vfs
default:

find-external-on-startup=yes
default: no

mime-types=*.htm;*.html|text/html|*.jpg;*.jpeg;*.jpe|image/jpeg|*.gif|image/gif|*.png|image/png|*.bmp|image/bmp|*.ico|image/x-icon|*.mpeg;*.mpg;*.mpe|video/mpeg|*.avi|video/x-msvideo|*.txt|text/plain
default: *.htm;*.html|text/html|*.jpg;*.jpeg;*.jpe|image/jpeg|*.gif|image/gif|*.png|image/png|*.bmp|image/bmp|*.ico|image/x-icon|*.mpeg;*.mpg;*.mpe|video/mpeg|*.avi|video/x-msvideo|*.txt|text/plain|*.css|text/css

address2name=Mike|xx.xxx.xx.xx|Mike J Laptop|xx.xx.xxx.xx|Mike J Home|xx.xxx.xx.xx|Mike Home|xx.xxx.xxx.x|New Jersey|xx.xxx.xxx.xx
default:

recents=C:\My Documents\HFS.vfs
default:

tray-instead-of-quit=yes
default: no

out-total=135108178
default: 0

in-total=10388769
default: 0

copy-url-on-start=yes
default: no

connections-columns=IP;170|Filename;160|Status;100|Speed;80|Time left;55|%;512|
default: IP;120|Filename;180|Status;180|Speed;60|Time left;55|%;50|

Thank you,
Chris
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on February 18, 2007, 04:49:58 AM
no idea.
and i actually don't know what the reverse proxy is.
let us know if you find something more.
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: Admin_from_Hell on April 13, 2007, 09:17:24 AM
HFS takes the Iconfiles always from the root folder.
The Apache reverse proxy takes the HFS-root to a subfolder of root e.g. /application-install/.
Now HFS still tries to get the icon files from / but there's nothing to find.
The solution would be that it would be possible to tell HFS to get his icon-files from a subfolder, or it would use relative links instead of absolute links to root.
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on April 19, 2007, 04:51:04 PM
HFS takes the Iconfiles always from the root folder.
The Apache reverse proxy takes the HFS-root to a subfolder of root e.g. /application-install/.
Now HFS still tries to get the icon files from / but there's nothing to find.

you are telling me that this proxy thing transforms the URL /~imgxx into /path/~imgxx ?
i don't see a reason for such behaviour, it seems a bug to me. do you know the reason?

Quote
The solution would be that it would be possible to tell HFS to get his icon-files from a subfolder, or it would use relative links instead of absolute links to root.

special URLs make impossible for you to use such filenames, that's why i limited them to the root.
and even if i would let them be working also in folders, the default template should always use the root, because this way the browser uses the cache instead of downloading the same icon twice, so you should edit the template yourself to make it work.
anyway i'm open to make the change i just described if you induce me to think the behaviour of this proxy thing is not a bug. How can this thing expect an URL works if it changes the path?
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: chris.zeman on July 02, 2007, 04:05:35 AM
Hi rejetto,

No, it's not a bug. I have a THEORY as to why Apache does this. I don't know if Apache is the only web server that does this, but here is my theory. If there was a web server with the domain example.com, and the server administrator allowed each user to have a web site on their server, the site would typically be accessed by going to http://example.com/~username. The server knows by the tilde (spelled right?) to serve the files located in the user's home directory.

I believe Apache is looking for home directories for imgxx or whatever. I think (and hope) I explained this right. :)

I think Admin_from_Hell's suggestion would do the trick.

Thank you,
Chris
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on July 02, 2007, 10:19:24 AM
yes, maybe...  but as far as i know, the ~ has nothing to do with apache itself, it's a just a convention for user folders inherited by unix, where ~ means the user "home".
so, perhaps ~frank is just a link on the disk to the user www space, and apache doesn't treat it in any special way, just follows the file system.
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: chris.zeman on July 02, 2007, 11:26:57 AM
Yes, exactly. :)

I downloaded every image, moved it to a directory on my server, and then modified the template in HFS to load the images from a URL that wasn't being forwarded through my server. It didn't work right for some reason. I can't remember what icon showed up next to all the files, but it was the same for all the files. I must have done something wrong.

Chris
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: chris.zeman on August 29, 2007, 03:57:43 AM
I'll tell you what, Rejetto. I'll pledge $10 towards HFS is we can get this working. :)

Here is my Virtual Host configuration. Maybe someone will notice something that's missing. Perhaps the solution is simple. :)

Code: [Select]
NameVirtualHost *
<VirtualHost *>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                #RedirectMatch ^/$ /apache2-default/
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

RewriteEngine On
RewriteRule .* - [CO=BALANCEID:balancer.automation:.domain.net]
</VirtualHost>

<VirtualHost *>
    ServerName eng.domain.net
    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass / http://172.16.1.20/
    ProxyPassReverse / http://172.16.1.20

    <Location />
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>


Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: chris.zeman on September 04, 2007, 04:42:47 AM
$25? ???
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on September 05, 2007, 06:00:38 AM
i guess you would get more help by the apache community.
did you notice ProxyPass has a trailing slash while ProxyPassReverse has not?
i saw an example on the apache website and it has no slash
Quote
ProxyPass /foo http://foo.example.com/bar
ProxyPassReverse /foo http://foo.example.com/bar

anyway, it's strange you are proxying the /
is that apache really serving any page on its own?
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: ELEVENNNN on October 24, 2007, 04:13:25 AM
I read everything said and it doesnt sound like apache needs to be altered, it isnt working ideally by default but i'd imagine you can put absolute path's in your template so that it just calls it from a location (it would act as if it was a non-local address, but in fact it would be).  you said that when you made changes you got all the same icons, so thats somewhere to start. I would try doing a find+replace within the template and add absolute paths.  If that doesnt work you can tackle the harder stuff  :D

If my answer is blatantly wrong and I missed something feel free to slap me with a wet something of your choice.
-Kurt
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: ELEVENNNN on October 24, 2007, 04:46:57 AM
Since your running a reverse proxy with apache im sure you have some unix roots but just in case, what I mean is.

in your template instead of /template/icons/myicon.gif
you put
http://myserver.com/template/icons/myicon.gif (Appears external but it works)

Let everyone know your sucess/failure.
-Kurt
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: Unknown8063 on November 21, 2007, 08:23:53 PM
OMG I cannot believe I didn't see this thread earlier :)  Probably because I don't lurk in the router and ports forum.

I also run HFS behind a reverse proxy and noted the missing 16x16 icon images.  It's been bugging me for awhile but recently I just switched to Terayon because it doesn't use the icon images (which evidently is the only thing broken). Has there been a solution to this issue?

While at first convincing, I do not think the theory that the tilde conflicts with user home folders is accurate.  I can still access /~upload right on the root without problems.  Additionally, if I attempt to access the images directly from the address bar HFS fires off a 404 instead of Apache so it is clearly going through the reverse proxy correctly.
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on November 21, 2007, 08:42:45 PM
is actually HFS giving the 404 ?

disable "log what - only served requests"
enable "log what - replies"
enable "log what - requests"
then access the images directly and see what the log says
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: Unknown8063 on November 21, 2007, 11:50:23 PM
I ran the test as described using build 144 and received the following:

11/21/2007 3:47:53 PM 5.x.x.x:53041 Requested GET /~img8
11/21/2007 3:47:53 PM 5.x.x.x:53041 Not served: 404 - Not found
11/21/2007 3:47:53 PM 5.x.x.x:53042 Requested GET /~style.css
11/21/2007 3:47:53 PM 5.x.x.x:53042 Served 570 B
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on November 22, 2007, 02:10:52 AM
hfs is replying 404 to /~img8 ? :o
how could it be?
can you also enable dump request?
or even better post an hex dump of the request using a sniffer.
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: Mars on November 22, 2007, 02:22:30 AM
it seems that url line like ~img8 works only if you are in root

http://server/~command      works good

http://server/folder/~command  don't works : page introuvable

only ~login works anywhere

This is bound to the way is tested the url for the commands preceded of ~ :-\
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on November 22, 2007, 02:29:31 AM
yes mars, this is the wanted behaviour.
i don't see how this can be related to their problem.
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: Unknown8063 on November 22, 2007, 02:47:10 AM
Attached is the log file using the requests dump, also on a direct access attempt of /~img8.

Rejetto, if this doesn't help I ca do the hex dump too.  Thanks for the help!
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on November 22, 2007, 12:46:04 PM
ok now i have a clue for further investigations, thank you
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on November 24, 2007, 06:54:53 PM
Thank you 8063, the bug is finally fixed in next build #146 ;)
it was actually a bug in HFS
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: Unknown8063 on November 25, 2007, 02:01:55 AM
Thank you Rejetto! I can confirm that the bug is fixed.
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: KlausR on March 11, 2008, 09:34:53 AM
The issue lies with a problem with Apache proxy not translating the ~ character correctly. The ~ is urlencoded which is not compatible with HFS. Upgrade to a version of Apache greater than 2.2.6. At the time of this posting the current version is 2.2.8
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on March 11, 2008, 10:03:50 PM
as stated above, it was an HFS bug, and it has been fixed
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: KlausR on March 12, 2008, 02:32:42 PM
Please see attached for the log file. The log file was generated with HFS 2.2d and with Apache 2.2.0 as a reverse proxy.

The log file shows the log in page.  Have a look at how ~img27 is translated.

The problems went away after upgrading to 2.2.8.

See change log in Apache for 2.2.6:
http://www.apache.org/dist/httpd/CHANGES_2.2
*) mod_proxy: don't URLencode tilde in path component
    PR 38448 [Stijn Hoop <stijn sandcat.nl>]

Thanks for a great product.
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: rejetto on March 12, 2008, 03:41:09 PM
thanks for reporting klausr.
actually, the encoding by apache was not due, and it is better it now doesn't.
while such encoding is not advisable, it is allowed by the protocol (i think), and so i considered it an HFS bug, to handle it incorrectly.

the result is that HFS 2.3 handles such problematic request successfully.
sadly, i forgot to include this fix in last 2.2 release. And i guess i won't, since i hope 2.3 will go stable soon.
Title: Re: HFS Icons through an Apache Reverse Proxy
Post by: Fysack on April 22, 2008, 09:55:15 PM
$25? ???

 ;D LOL you cant be fucking serious man  :-\ ..how about every dude in your organization throw in 25  ;)