Apache and samba - weird issue



  • We have a large number of pdf's (about 9 gigs worth) that need to be accessible via the web.  Since all the systems here were already set up using samba, I mounted the samba share to our webserver and made a symlink to the mount dir within the web dir.  This is working just fine... as long as you're using Internet Explorer.  Firefox, chrome, and opera are all refusing to open the pdf's.  It also fails on any images, but text and html seem to work fine from the samba share.  Even stranger, downloading the link creates an un-usable file, again, with all but IE.  

     Any ideas on this at all guys?  It's not a huge deal, just an annoyance.

     Also, It's preferred not to just move all the files to the webserver.  If it comes down to it, it's what we will do, but keeping these files on the scan station is what they want.

     



  • Probably not an issue with samba. Possible reasons: 1) You're using the wrong path seperator "" vs "/" 2) You're using some MS specifc HTML extension



  •  I don't see where it can be a path issue.  The samba mount is symlinked as the directory "scans" in the website's root - /var/www/html/website/scans .  Anything from there on should just act like it's a static file on the webserver.

     In IE, going to http://www.website.com/scans/scan.pdf loads perfectly.  Doing the same in firefox, chrome, safari, opera, etc etc, the pdf just fails to load.

     When the pdf is sitting on the webserver itself, and not the samba mount, everything works fine, regardless the browser.  This makes me very certain it's not MS-specific code.  The entire site is built in php, and our developer is majorly into web standards.

     



  • echo "HEAD /" | netcat 10.0.0.1 80
    ... and ...
    curl 10.0.0.1 | strings | head

    Output of those?



  •  # echo "HEAD /" | nc 127.0.0.1 80

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>400 Bad Request</title>
    </head><body>
    <h1>Bad Request</h1>
    <p>Your browser sent a request that this server could not understand.<br />
    </p>
    <hr>
    <address>Apache/2.2.8 (Fedora) Server at website.com Port 80</address>
    </body></html>

     

    and

     

    # curl 127.0.0.1 | strings | head
     

    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   419  100   419    0     0   264k      0 --:--:-- --:--:-- --:--:--     0
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Redirecting to Website</title>
    <head>
    <script language="javascript">
    location.replace("index.php")
    </script>
    </head>



  • Sorry, I posted that when tried. The headers for the PDF would've been more useful.



  • Possible lead: IE doesn't make a HTTP request in the same way as other browsers.

    For example,  IE sends domain information, which means I don't have to log in for some of our local, non-public websites, while Firefox et al present a login dialog.



  •  What do those unusable files look like? Open them with an editor, maybe those are server error HTML files that tell you what's wrong.



  •  Indeed, this is what was happening.  I failed to test it from an outside source when I first noticed the problem.  Locally, IE was passinging network-share information, allowing it to to download the pdfs.  From an outside PC, even IE got the same error as other browsers,

     

    Solution:

    rsync script that copies the files to the webserver once a week.  Does what we need, doesn't really hurt disk space too much, and gives us a good backup of all the pdf scans.

     

    Thanks for everyone's input though.  I'm still curious about sharing content lined from a mounted sambe share.  It all seems to be in the permissions really, but being a windows networking dunce, I'll just have to keep digging.


  • I survived the hour long Uno hand

     Sometimes I think TRWTF is samba. Despite being fairly integrated into various GUIs, doing anything graphically tends to lead to wonky results - shares being "mounted" without being mounted, files allowing themselves to be edited by someone who doesn't have permission by changing the owner to that user... Weird stuff. 



  • That's normal. I have even more running:

    root@molly:~#ps -ax | grep smb
    997 ?? Ss 0:09.05 /usr/local/sbin/nmbd -D -s /usr/local/etc/smb.conf
    1001 ?? Is 0:03.52 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
    1005 ?? Ss 0:01.29 /usr/local/sbin/winbindd -s /usr/local/etc/smb.conf
    1042 ?? I 0:00.00 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
    1065 ?? I 0:00.38 /usr/local/sbin/winbindd -s /usr/local/etc/smb.conf
    1125 ?? I 0:00.04 /usr/local/sbin/winbindd -s /usr/local/etc/smb.conf
    1126 ?? I 0:00.00 /usr/local/sbin/winbindd -s /usr/local/etc/smb.conf
    76486 ?? I 0:01.40 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
    85565 ?? I 0:43.19 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
    82978 1 S+ 0:00.00 grep smb

     


Log in to reply