Using Azure Web Site as a reverse proxy

IIS has been supporting reverse proxy configuration since URL Rewrite and Application Request Routing modules were released a few years ago. It is possible to configure an IIS hosted web site to act as a reverse proxy and forward web request to other URL’s based on the incoming request URL path. This is described in details in Reverse Proxy with URL Rewrite v2 and Application Request Routing.

Not too many people know however that the same kind of configuration can be achieved with a web site hosted in Azure Web Sites. This blog post explains the configurations steps to enable that.

For example if I want to forward all the requests that come to http://ruslany.net/proxy/ to some other URL I’ll need to do two things:

  1. Enable proxy functionality in ARR
  2. Add a proxy rewrite rule

Continue Reading »

15 Comments »

ruslany on May 16th 2014 in URLRewrite, WAWS

30,749 views

PoorFairAverageGoodExcellent (5 votes, average: 4.20 out of 5)

Azure Web Sites – block web access to non-production deployment slots

Windows Azure Web Sites supports Staged Publishing functionality, which allows you to create a staging site slot where you can publish a new version of the website and then test it before swapping to the production environment. By default the non-production deployment slot has its own hostname that you use to test the bits deployed there. Sometimes, however you may want to prevent users from browsing to your non-production deployment slot while you are testing it.

It is relatively easy to configure your site to block the http request if it is deployed to any non-production slot. For example let’s say I have a site ruslany.azurewebsites.net and I created a deployment slot for it and name the slot as ‘staging‘ (it is possible to give custom names to deployment slots now). The hostname for that deployment slot will be ‘ruslany-staging.azurewebsites.net‘. So to prevent access to the deployment slot from anybody except a few allowed IP addresses I can add the following rewrite rule to my site’s web.config file:

<rule name="Block unauthorized traffic to staging sites" stopProcessing="true">
<match url=".*" />
<conditions>
<!-- Enter your staging site host name here as the pattern-->
<add input="{HTTP_HOST}" pattern="^ruslany\-staging\." />
<!-- Enter your white listed IP addresses -->
<add input="{REMOTE_ADDR}" pattern="123\.123\.123\.1" negate="true"/>
<!-- Add the white listed IP addresses with a new condition as seen below -->
<!-- <add input="{REMOTE_ADDR}" pattern="123\.123\.123\.2" negate="true"/> -->
</conditions>
<action type="CustomResponse" statusCode="403" statusReason="Forbidden"
statusDescription="Site is not accessible" />
</rule>

When the site with this rule is located in my staging slot any http request to it will be blocked with HTTP 403 response as long as it is not a request from a white-listed IP address in the rewrite rule. When the site is swapped into the production slot the rewrite rule will be no-op because the first rewrite condition will not match, so all http traffic will be allowed to the site.

No Comments »

ruslany on April 24th 2014 in URLRewrite, WAWS

15,532 views

PoorFairAverageGoodExcellent (2 votes, average: 4.50 out of 5)

Azure Web Sites – Continuous Deployment with Staged Publishing

In the beginning of the year Windows Azure Web Sites team has released a preview of the Staged Publishing functionality. The Staged Publishing allows you to create a staging site slot where you can publish a new version of the website and then test it before swapping to the production environment. This feature together with Continuous Deployment via GitHub, BitBucket or DropBox enables some very powerful deployment scenarios.

However the preview release did not provide the optimal experience for enabling Continuous Deployment (CD) for staging site. User had to configure a non-trivial workaround as described in blog post by Rick Rainey. Recently the Azure Web Sites team has released an update that fixes that problem and makes the setup of the CD with staged publishing very simple. This blog post describes how to enable CD from git repository located on BitBucket. Continue Reading »

No Comments »

ruslany on March 27th 2014 in Other, PHP, WAWS

20,000 views

PoorFairAverageGoodExcellent (2 votes, average: 5.00 out of 5)

PHP 5.5, WinCache 1.3.5 available in Azure Web Sites

The recent upgrade of Windows Azure Web Sites includes several PHP related improvements:

First, the PHP 5.5 is now available. The PHP 5.4 becomes the default version used for newly created sites.

Note that there is no SQL Server Extension support for PHP 5.5.
Continue Reading »

2 Comments »

ruslany on December 11th 2013 in PHP, WAWS, WinCache

17,441 views

PoorFairAverageGoodExcellent (2 votes, average: 5.00 out of 5)

How to backup Windows Azure Web Sites

Windows Azure provides a reliable web sites hosting infrastructure where sites data is replicated in Azure data centers for redundancy. However it is still important to do regular backups of the site’s content and databases in order to be able to recover from a human error, problematic upgrade or a hacking attempt. With the Azure Store Add-On Cloud Cellar it is easy to setup automated backup task that will run on a predefined schedule and will backup site content and database. This post explains how to do it. Continue Reading »

1 Comment »

ruslany on October 24th 2013 in WAWS

14,344 views

PoorFairAverageGoodExcellent (1 votes, average: 5.00 out of 5)

How to setup IP SSL on Windows Azure Web Sites

Azure Web Sites started to support custom domains SSL functionality recently. There are two SSL modes supported:

  1. SNI based SSL. This is an extension to SSL and Transport Layer Security (TLS) that allows multiple domains to share the same IP address, with separate security certificates for each domain. Most modern browsers (including Internet Explorer, Chrome, Firefox and Opera) support SNI, however older browsers may not support SNI.
  2. IP based SSL. This mode associates a certificate with a domain name by mapping the dedicated public IP address of the server to the domain name. This requires each domain name (contoso.com, fabricam.com, etc.) associated with your service to have a dedicated IP address. This is the traditional method of associating SSL certificates with a web server.

The SNI SSL setup is pretty simple and is documented in “How to enable SSL web site“.  The IP SSL setup is more tricky, and unfortunately an important step is missing from that article. Without performing that step the domain name configured for IP SSL will continue to work as SNI SSL. The Windows Azure team is looking into fixing the documentation and UI workflow to prevent this confusion going forward. Meanwhile this blog post explains how to make sure IP SSL is configured correctly. Continue Reading »

5 Comments »

ruslany on July 1st 2013 in WAWS

79,903 views

PoorFairAverageGoodExcellent (2 votes, average: 5.00 out of 5)

Cloud Cellar: Azure Web Sites Backup Service

My site (RuslanY.net) is powered by WordPress and is hosted on Windows Azure Web Sites. I’ve migrated it from a private hosting to Windows Azure last year and since then I am pretty happy about the level or reliability and performance that I got on Windows Azure. The one thing that I’ve been missing though was the regular backups that I used to have when I self-hosted my site. I backed up the site content and the database regularly and those backups have saved me several times. Often when I upgraded some WordPress plugins, the newer plugin version got some bug or change in behavior that I did not like. On those occasions I just restored the site from the most recent backup that I took. I really wanted to have this capability even when hosting my site in Windows Azure.

That’s what prompted me and my friends (Bilal Aslam, Robert Lucero and Michael Dorian Bach) to develop a backup service for Windows Azure web sites. The service is called Cloud Cellar and is now live in beta at

https://www.getcloudcellar.com/ Continue Reading »

No Comments »

ruslany on June 27th 2013 in Other, WAWS, WordPress

24,519 views

PoorFairAverageGoodExcellent (2 votes, average: 5.00 out of 5)

Azure Web Sites – WordPress plugin update bug fixed

Windows Azure Web Sites has recently been upgraded to a new version. Among all the improvements and bug fixes in the new version there is one change that fixes a known issue with update of WordPress plugins. There have been numerous questions about this problem at the Azure Web Sites forum. Continue Reading »

4 Comments »

ruslany on March 20th 2013 in PHP, WAWS, WinCache, WordPress

63,856 views

PoorFairAverageGoodExcellent (1 votes, average: 5.00 out of 5)

PHP Troubleshooting in Windows Azure Web Sites

The need to diagnose and troubleshoot application’s failures often comes up during deployment to a hosting environment. Some configuration settings in hosting server may differ from what application expects. Often it is not as easy to figure out the cause of the problem in a hosting environment as it is on a development machine.  I found the following techniques useful when troubleshooting errors in PHP applications hosted in Windows Azure Web Sites.

1. phpinfo()

This is the most obvious, but very often the most helpful diagnostics tool. The output of this function provides a lot of information about the PHP runtime. Use it to determine what PHP extensions are enabled, what are the PHP configuration settings and what values are stored in server environment variables. Continue Reading »

1 Comment »

ruslany on January 30th 2013 in PHP, WAWS

75,675 views

PoorFairAverageGoodExcellent (4 votes, average: 5.00 out of 5)

phpMyAdmin on Windows Azure Web Sites

In my previous post about the migration of a WordPress site to Windows Azure I mentioned that I used phpMyAdmin to import existing blog data into a MySql/ClearDb database in Windows Azure. phpMyAdmin is a web based tool for administering MySql databases. It can be used to create tables, edit the data in tables, export/import/backup data and many other tasks. I found it to be an adequate tool for all MySql db administration needs in Windows Azure. This post describes how to install and configure phpMyAdmin on Windows Azure Web Sites. Continue Reading »

14 Comments »

ruslany on December 17th 2012 in PHP, WAWS

35,605 views

PoorFairAverageGoodExcellent (5 votes, average: 5.00 out of 5)

Recently Published Articles