Announcement

Collapse
No announcement yet.

Help! Setup DOCX attachment/mime type, now users get 500 server error trying to view/download these attachments

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help! Setup DOCX attachment/mime type, now users get 500 server error trying to view/download these attachments

    I recently tried to setup the Word DOCX attachment type in vBulletin 4.2.5:-
    Extension: .docx
    Mimetype: application/vnd.openxmlformats-officedocument.wordprocessingml.document
    Enabled for Forums Albums, posts and groups.
    No open in window.
    I also added a docx.gif in /images/attach.

    Users are now able to upload and add docx attachments fine.
    However, when any tries to click on and view/download these docx attachments they get a 500 Server Error:
    500 - Internal Server Error

    This is a temporary server error.

    Please try to reload the webpage later.

    If you are the webmaster of this site please log in to Cpanel and check the Error Logs. You will find the exact reason for this error there.

    Common reasons for this error are:
    • Incorrect file/directory permissions: Above 755.

      In order files to be processed by the webserver, their permissions have to be equal or below 755. You can update file permissions with a FTP client or through cPanel's File Manager.
    • Incorrect Apache directives inside .htaccess file.

      Make sure you have not specified unsupported directives inside the local .htaccess file. Such include PHP settings and Apache module settings.

    I'm struggling to find any errors in logs that give any clue what's going wrong here.
    Nothing in related /logs
    Nothing in related in CPanel Error Log view
    Nothing in VBulletin Log Manager.

    I've tried adding the mimetype to the .htacces file:
    AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document .docx
    But that made no difference.

    All other attachment types work fine, upload and download.

    Any ideas much appreciated.
    Thanks
    Arthur.

  • #2
    A 500 server error comes from the Web Server, not vBulletin. You need to ask your host what the cause the error. They have the logs that state what the problem is. I am guessing it is the permissions problem because the attachment directory needs to be chmod 777 in order to have vBulletin write to it. This directory probably needs to be outside and above your web root (public_html) directory.

    You shouldn't have to add anything to your .htaccess and under no circumstances should you treat Word documents as an application on your server.
    Last edited by Wayne Luke; Sat 8th Jun '19, 9:37am.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud customization and demonstration site.
    vBulletin 5 Documentation - Updated every Friday. Report issues here.
    vBulletin 5 API - Full / Mobile
    I am not currently available for vB Messenger Chats.

    Comment


    • #3
      Yes, granted, the error is coming from Apache and vBulletin, I'll try to hunt down more details in logs.

      What confuses me, is vBulletin is configured to store attachments in the DB, so why could it be moaning about file/folder permissions? From the ACP, Attachment Storage Type:
      Storage Type: Attachments
      Attachments are currently being stored in the database
      It also confuses me, that other mimetypes can be uploaded and downloaded fine. Yet docx types can be uploaded, but not downloaded.
      I'll dig into apache logs more and continue investigating.

      Thanks!

      Comment


      • #4
        If you're storing attachments in the database, then I have no clue why it is throwing a 500 server error. Your hosting provider can provide more insight and assist. I have no problem using the docx format as attachments on my local test server.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud customization and demonstration site.
        vBulletin 5 Documentation - Updated every Friday. Report issues here.
        vBulletin 5 API - Full / Mobile
        I am not currently available for vB Messenger Chats.

        Comment


        • #5
          Quick update:
          Still not finding any clues in apache error and access logs. Nowt in error log, and only this in access log:

          x.x.x.x - - [10/Jun/2019:12:56:04 +0100] "GET /forum/attachment.php?attachmentid=1401&d=1559939656 HTTP/1.0" 500 1862 "https://elam.org.uk/forum/showthread.php/2512-test-docx-upload-permissions" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
          However, whilst stabbing in the dark, I tried setting the mimetype in vBulletin to 'Content-type: application/msword', instead of 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'. And guess what? It works now! I can click on a .docx attachment, get prompted to download it (with original docx filename) and can then open the docx file.

          No idea, what's going wrong here. Got to be something with regards to mimetype config in Apache. I'm hosting on SiteGround, who have disabled the mimetype editing within CPanel and just give these instructions for editing config directly in .htaccess files: https://www.siteground.com/kb/add-mime-types/ Which I did, as described in first post.

          Either way, at least I have a working solution, even if no concrete explanation. Thanks for help.

          Comment


          • #6
            Your hosting provider is trying to do something with the docx mimetype that is breaking. We have no control over that.
            Translations provided by Google.

            Wayne Luke
            The Rabid Badger - a vBulletin Cloud customization and demonstration site.
            vBulletin 5 Documentation - Updated every Friday. Report issues here.
            vBulletin 5 API - Full / Mobile
            I am not currently available for vB Messenger Chats.

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X