How to fix the secure RSS glitch in Outlook brought to you by META Q
Interior Ad 2 brought to you by The META Q

How to fix the secure RSS glitch in Outlook

While adding an RSS feed to one of our client’s sites, I encountered a very interesting and perplexing issue. Shortly after the feed was implemented, I realized that it was not working with the Microsoft Outlook Aggregator. Every time someone tried to subscribe to the feed via Outlook, they would receive a message which stated the following:

“We cannot download Web_site_url because of a problem connecting to the server.”

While this isn't the worst error message in the world, it’s annoying because it's so vague. Ultimately, to figure out what was really going on, I had to turn to good ol’ Google.

The Outlook Aggregator doesn’t play well with HTTPS

It turns out that the problem we were experiencing is actually a well-documented bug/feature conveniently ignored/included by Microsoft.

Simply stated, the Outlook Aggregator does not work well with HTTPS connections. Of course, the site in question does have an SSL certificate and all users are immediately redirected to the secure connection when visiting.

Once I figured out that the problem was related to the HTTPS connection, the next problem was figuring out how to fix it. Fortunately, once you know what was actually happening, the solution was quite easy to come by.

The solution lies on the RSS page

All you need to do is modify the .htaccess file and allow both HTTPS and HTTP connections to be made on the RSS page and only the RSS page (this is for security purposes and also to avoid duplicate content, since search engines consider HTTP/HTTPS sites to be different entities).

This is what the solution looks like, in code form:

 RewriteCond %{REQUEST_URI} (rss)
 RewriteCond %{HTTP_HOST} ^somedomain\.com$
 RewriteRule ^(.*)$ http://www.somedomain.com/rss [R=301,L]

 RewriteCond %{REQUEST_URI} !(rss|index.php?)
 RewriteCond %{ENV:HTTPS} !^on$ [OR]
 RewriteCond %{HTTP_HOST} ^somedomain\.com$
 RewriteRule ^(.*)$ https://www.somedomain.com/$1 [R=301,L]

Mind you, this site in question is hosted on Rackspace Cloud. If you find yourself in a similar situation, try the above code, but depending on your host, your own solution might be slightly different.

The two most important parts of the code above are:

  1. Line one in each block
  2. The order of the rewrite conditions and their corresponding blocks

The breakdown

The first line in each block is basically checking the URI for specific strings. In block 1, if 'RSS' is found in the URI, then do a real quick check to make sure that the domain has 'www', and if it doesn't, add it in and rewrite the URL. This block is not necessarily required, but I included it for consistency across the site.

In line one of block 2, we check to see whether or not 'RSS' and 'index.php?' are in the URI ('index.php?' is included here because at this point you should not have removed it from the URI string). If those strings are not found, then it means HTTPS is turned on (line 2 – block 2).  Check the domain for 'www' and then return the proper page. If 'RSS' and 'index.php?' are found, then block 2 is not executed. This means that users can access the RSS page via an HTTP connection, and effectively solves the buggy behavior of Microsoft Outlook.

Ever dealt with buggy RSS behavior from Outlook? Share your tips, tricks and horror stories below!

Photo credit: derrickkwa


Clinton Reeves's avatar

Clinton Reeves

Back-end developer at Q Digital Studio

Clinton Reeves is a back-end developer at Q Digital Studio. He is a self-proclaimed nerd and happily embraces said nerdiness. He lives his life in a world of text (code code code), and even dreams in code. Clinton's day isn't complete without at least eight cups of coffee.

Posted

9.25.2012

Categories

Code > Code Process > Tips > Code Tips

Tags

code, htaccess, outlook, tips, web

0 comments >

What others are saying

No one has commented on this entry yet.


Speak your mind