Monthly Archives: August 2013

Apache – Disable HTTP TRACK / TRACE Methods

To turn off track and trace methods for individual virtual hosts add the follwowing to the vhost config:
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* – [F]

Dont’ forget to restart apache when you saved the vhost config file.

How to test HTTP Errorcode 400.

To extra secure your webserver you may want to create your own ErrorDocument for different errorcodes.

For example errorcode 400.
To test this go to your website /%

example:
http://www.iterrors.com/%

(It seems my host isn’t 100% secure :)).

Outlook – Automatically save an outlook attachment to disk

If you want to automatically save an attachment to a folder on your computer/server do the following:

Open Outlook and open Microsoft Visual Basic for Applications (Alt + F11).
Expand the tree view on the left till you reach ThisOutlookSession, now right click on ThisOutlookSession and select insert -> module.

You will now get a blank window, copy and paste this code:

Public Sub saveAttachtoDisk (itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "c:\temp\"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
Set objAtt = Nothing
Next
End Sub

Change the ‘saveFolder’ to something you want.
Save and close the Visual Basic app.

Now you will need to create a rule in Outlook that launces this script when an email arrives.

Go to Tools -> Rules and alerts -> New rule and choose Check message when they arrive -> with attachment (for example) -> run a script, click script and select your newly created VB script. Click finish and sent an test email.

If nothing is happening you probably should change the macro settings in Outlook: In Outlook go to File -> Options -> Trust center -> Trust center settings -> Macro settings and select ‘Notifications for all macros’ and click Ok.

Restart Outlook, you will get a message that your newly created script is trying to make changes to Outlook, allow that and try to send a test message again!

I tested this in Outlook 2010.