URLRewrite Archives - RuslanY Blog Azure App Service Features and Best Practices Tue, 27 Aug 2019 17:37:16 +0000 en-US hourly 1 https://wordpress.org/?v=6.2.16 https://ruslany.net/wp-content/uploads/2019/05/cropped-web-32x32.png URLRewrite Archives - RuslanY Blog 32 32 Using Azure Web Site as a reverse proxy https://ruslany.net/2014/05/using-azure-web-site-as-a-reverse-proxy/ https://ruslany.net/2014/05/using-azure-web-site-as-a-reverse-proxy/#comments Sat, 17 May 2014 00:04:57 +0000 http://ruslany.net/?p=48081 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 … Continue reading "Using Azure Web Site as a reverse proxy"

The post Using Azure Web Site as a reverse proxy appeared first on RuslanY Blog.

]]>
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 https://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

Any site hosted in Azure Web Sites has URL Rewrite and ARR enabled. However the proxy functionality is disabled by default in ARR. To enable that we will use the Azure Site Extension XDT transform which will modify the applicationHost.config file for our site and will enable proxy features.

This is the xdt transform file content to enable proxy:

<!--?xml version="1.0"?-->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.webServer>
    <proxy xdt:Transform="InsertIfMissing" enabled="true" preserveHostHeader="false" reverseRewriteHostInResponseHeaders="false" />
  </system.webServer>
</configuration>

Create a file named applicationHost.xdt and copy paste this code in there. Then upload this file into the “site” directory of your web site:

After that restart your site for the change to take effect.

Next add the following rewrite rule:

<configuration>
  <system.webserver>
    <rewrite>
      <rules>
        <rule name="Proxy" stopprocessing="true">
          <match url="^proxy/?(.*)" />
          <action type="Rewrite" url="http://www.iis.net/{R:1}"/>
        </rule>
      </rules>
    </rewrite>
  </system.webserver>
</configuration>

For the purposes of this example I configured proxy to forward all requests to http://www.iis.net/ but you can replace it with the target url of your site.  Now if I browse to http://ruslany.net/proxy/ the url rewrite rule will rewrite the request to a different url and then ARR will forward the request (notice the URL in the browser window. It is still my domain name which confirms that this not an HTTP redirect).

This functionality enables some interesting use cases. For example I could have two separate azure web sites ruslany-forum.azurewebsites.net and ruslany-blog.azurewebsites.net that can appear as if they are under same hostname but in different subfolders, e.g. http://ruslany.net/blog/ and http://ruslany.net/forum/.

Update:

Thanks to Bill Harts who discovered one additional important configuration step that is required if your site also uses ASP.NET MVC. When MVC is enabled on the web site used as a proxy then the MVC Router intercepts all the requests so they are not processed by ARR. So instead of request being forwarded to a destination server you get HTTP 404 – File Not Found error.

In order to fix this you’ll need to exclude the proxy route from the MVC routes by adding the following code to you MVC application:

routes.IgnoreRoute("proxy/{*pathInfo}");

The post Using Azure Web Site as a reverse proxy appeared first on RuslanY Blog.

]]>
https://ruslany.net/2014/05/using-azure-web-site-as-a-reverse-proxy/feed/ 53
Azure Web Sites – block web access to non-production deployment slots https://ruslany.net/2014/04/azure-web-sites-block-web-access-to-non-production-deployment-slots/ https://ruslany.net/2014/04/azure-web-sites-block-web-access-to-non-production-deployment-slots/#comments Thu, 24 Apr 2014 21:38:27 +0000 http://ruslany.net/?p=32321 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 … Continue reading "Azure Web Sites – block web access to non-production deployment slots"

The post Azure Web Sites – block web access to non-production deployment slots appeared first on RuslanY Blog.

]]>
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.

The post Azure Web Sites – block web access to non-production deployment slots appeared first on RuslanY Blog.

]]>
https://ruslany.net/2014/04/azure-web-sites-block-web-access-to-non-production-deployment-slots/feed/ 7
RuslanY.net running on Windows Azure Web Sites https://ruslany.net/2012/10/ruslany-net-running-on-windows-azure-web-sites/ https://ruslany.net/2012/10/ruslany-net-running-on-windows-azure-web-sites/#comments Mon, 22 Oct 2012 15:30:36 +0000 http://ruslany.net/?p=1401 I have not been writing any blog posts for a while. That was because for the past two years I have been busy working in a team that develops the Windows Azure Web Sites – a scalable web hosting platform in Windows Azure. Now that the Windows Azure Web Sites (WAWS) is publicly available I … Continue reading "RuslanY.net running on Windows Azure Web Sites"

The post RuslanY.net running on Windows Azure Web Sites appeared first on RuslanY Blog.

]]>
I have not been writing any blog posts for a while. That was because for the past two years I have been busy working in a team that develops the Windows Azure Web Sites – a scalable web hosting platform in Windows Azure.

Now that the Windows Azure Web Sites (WAWS) is publicly available I decided to try to move my site from private hosting  to Windows Azure. My site uses WordPress (with MySql database), PHP 5.3, WinCache object and user cache, URL rewriting and many WordPress plugins. With all these different technologies (many of which are not developed by Microsoft), I thought it would be a good test of how WAWS is capable of running web sites that use open source technologies. Plus I expect that my site will be more reliable and available, comparing to my previous private hosting.

I was pleasantly surprised that the migration from private hosting to WAWS hosting was relatively quick and simple. The site has been running successfully in a Shared compute mode for a while now and none of the site’s functionality has been lost or altered. In this post I’ll explain the steps I took to move my site to WAWS hosting. Hopefully it will be useful to those who are planning to migrate their WordPress based site to WAWS.

1. Signing up and creating an empty site

The sign up process is straightforward and quick. If you have not signed up before then you can get a 90-days free trial, where you can try all the WAWS hosting options for free. Once you complete the sign up process you will end up at the Windows Azure Management Portal and start creating sites. In my case I started by creating an empty free web site http://ruslany.azurewebsites.net. It takes only a few seconds to create a new site.

2. Creating a MySql database

WAWS works in partnership with ClearDb to provide MySql databases. If you have a relatively small web application with light traffic then the free MySql database provided in Windows Azure should be enough for you. You can create the database by going to the Linked Resources page  and adding a new Linked Resource:

Create MySql DB

My site’s database was bigger than 20 Mb in size, so I had to purchase the Venus Service Plan on the ClearDB site.

3. Importing data to a MySql database

WAWS provides a web management interface for SQL Azure databases. But not for MySql databases. That was not a problem however, because there is a well known web application for administering MySql – phpMyAdmin. To import the content of my blog I created a new site under my subscription (10 free sites are allowed per subscription) and installed phpMyAdmin there. phpMyAdmin provides a simple way of importing MySql content into a database:

Import Db Data

Unfortunately, phpMyAdmin is not yet available in the Windows Azure Web Application Gallery, so I had to install it manually by following the quick install guide.

Important thing to note about importing data using phpMyAdmin. Import requires uploading a sql file to the server. If the sql file is big, you may run into the PHP limit for maximum allowed size of uploaded file. It is possible to increase the limit by following instructions at Configuring PHP in Windows Azure Websites with .user.ini Files.

4. Point WordPress to new database

Once database import is complete, it is necessary to reconfigure WordPress to use new database. The configuration is stored in wp-config.php file. Change the DB_NAME, DB_USER, DB_PASSWORD, DB_HOST variables to the values provided by ClearDB.

5. Uploading the site content

There are several ways to publish content in WAWS:

  1. FTP
  2. WebDeploy
  3. Git
  4. TFS

In order to simplify publishing, I recommend to set the publishing password to something you can remember. Otherwise you’ll have to use the randomly generated password that WAWS provided for your site.

Reset Publishing Password

FTP was good enough for my needs. The FTP host name and user name are available in the site dashboard page. You can use any FTP client. Filezilla works pretty well for uploading large content.

5. Configuring custom domains

After I uploaded content I just browsed to http://ruslany.azurewebsites.com/ and the site was up and running. Obviously I did not want to use this domain for my site, so the next step was to associate http://ruslany.net/ with this site.

Free sites in WAWS are not allowed to have custom domains, so I had to upgrade my site to “Shared” compute mode.  Apart from custom domains support, there are other benefits of this mode: less restrictive usage quotas and no outgoing bandwidth limit.

Configuring custom domain is a straightforward process described in Windows Azure documentation. It is a good idea to associate both A record and the WWW CName with a site. In my case for example both http://ruslany.net and http://www.ruslany.net/ are associated with the site:

Custom Domains

Conclusion

There are a couple of minor limitations that still need to be fixed in WAWS:

  • An old version of Wincache extension is used which causes failures when upgrading plugins.
  • It would be nice to have phpMyAdmin available in the Web Application Gallery.

Other than that I am pretty happy with how my site is running in Windows Azure Web Sites so far. WAWS is capable and flexible enough to support all the custom configuration settings that my site uses.

  • Wincache object and user caches work well. They reduce load on the MySql database and make the response time faster.
  • URL rewriting is fully supported, so my site is still optimized for search engines and has pretty permalinks.
  • All the plugins work without problems.

As I find out more tips and tricks about hosting web sites in Windows Azure Web Sites I will write about them in this blog.

The post RuslanY.net running on Windows Azure Web Sites appeared first on RuslanY Blog.

]]>
https://ruslany.net/2012/10/ruslany-net-running-on-windows-azure-web-sites/feed/ 6
Storing URL rewrite mappings in a separate file https://ruslany.net/2010/05/storing-url-rewrite-mappings-in-a-separate-file/ https://ruslany.net/2010/05/storing-url-rewrite-mappings-in-a-separate-file/#comments Wed, 19 May 2010 20:00:37 +0000 http://ruslany.net/?p=760 When using rewrite maps in IIS URL Rewrite it is very common to have a very large number of entries in a rewrite map. In order to avoid cluttering the configuration file – web.config – with this configuration data the rewrite maps can be defined in a separate configuration file. That file can then be referenced from the web.config file. … Continue reading "Storing URL rewrite mappings in a separate file"

The post Storing URL rewrite mappings in a separate file appeared first on RuslanY Blog.

]]>
When using rewrite maps in IIS URL Rewrite it is very common to have a very large number of entries in a rewrite map. In order to avoid cluttering the configuration file – web.config – with this configuration data the rewrite maps can be defined in a separate configuration file. That file can then be referenced from the web.config file. This post provides an example of how this can be done.

Create a file called rewritemaps.config in the same directory where web.config file is. Open that file in notepad and add the following:

<rewriteMaps>
  <rewriteMap name="Redirects">
    <add key="/oldurl" value="/newurl" />
    <add key="/otheroldurl" value="/othernewurl" />
  </rewriteMap>
</rewriteMaps>

Save this file and then open web.config file in notepad. In the web.config file add the following inside of the <rewrite> section:

<rewriteMaps configSource="rewritemaps.config" />

The configSource attribute tells IIS configuration that the <rewriteMaps> section is defined in a separate file rewritemaps.config. This referenced section can be now uses as if it was defined in the same web.config file. Also, the IIS Manager UI will work well with this referenced file: when you modify or add entries to the rewrite map they will be stored in the rewritemaps.config file.

Here is a complete example web.config file that uses the rewrite map from referenced configuration file:

<configuration>
<system.webServer>
  <rewrite>
    <rewriteMaps configSource="rewritemaps.config"><rewriteMaps>
    <rules>
      <rule name="Redirect rule1 for Redirects">
        <match url=".*" />
        <conditions>
          <add input="{Redirects:{REQUEST_URI}}" pattern="(.+)" />
        </conditions>
        <action type="Redirect" url="{C:1}" appendQueryString="false" />
      </rule>
    </rules>
  </rewrite>
</system.webServer>
</configuration>

The same approach can be used for storing rewrite rules in a separate configuration file, e.g.:

<rules configSource="rewriteRules.config" />

The post Storing URL rewrite mappings in a separate file appeared first on RuslanY Blog.

]]>
https://ruslany.net/2010/05/storing-url-rewrite-mappings-in-a-separate-file/feed/ 43
IIS URL Rewrite 2.0 – Release to Web https://ruslany.net/2010/03/iis-url-rewrite-2-0-release-to-web/ https://ruslany.net/2010/03/iis-url-rewrite-2-0-release-to-web/#comments Thu, 11 Mar 2010 19:10:33 +0000 http://ruslany.net/?p=695 The IIS URL Rewrite Module 2.0 – RTW is available for download. IIS URL Rewrite v2.0 is an incremental release that includes all the features from version 1.1, and adds extensibility support and outbound response rewriting. More specifically, v2.0 can be used to: Express complex URL rewriting logic by using custom rewrite providers written in … Continue reading "IIS URL Rewrite 2.0 – Release to Web"

The post IIS URL Rewrite 2.0 – Release to Web appeared first on RuslanY Blog.

]]>
The IIS URL Rewrite Module 2.0 – RTW is available for download. IIS URL Rewrite v2.0 is an incremental release that includes all the features from version 1.1, and adds extensibility support and outbound response rewriting. More specifically, v2.0 can be used to:

  • Express complex URL rewriting logic by using custom rewrite providers written in .NET.
  • Replace the URLs generated by a web application in the response HTML with a more user friendly and search engine friendly equivalent
  • Fix up the content of any HTTP response by using regular expression pattern matching.
  • Modify HTTP request and response headers and IIS server variables.

For the complete list of features available in this version, refer to Using URL Rewrite Module 2.0.

Install the URL Rewrite 2.0 – RTW

To install the URL Rewrite 2.0, use the download links at the module’s home page at http://www.iis.net/expand/urlrewrite. Note that this is a final, production ready release that is officially supported by Microsoft.

Upgrade notes:

  • If a previous version of URL Rewrite Module, such as v1.0 and v1.1, is already installed then it will be upgraded to the v2.0;
  • If an RC version of the URL Rewrite Module 2.0 is already installed, then it will be upgraded to RTW version.

Install the URL Rewrite Extensibility Samples

An important new feature in this release is the support for custom rewrite providers that can be written in .NET. Custom rewrite providers can be used to implement complex rewrite logic which cannot be expressed by using built-in rewriting functionality.

The URL Rewrite Extensibility Samples include the .NET assemblies and the source code implementing the following providers:

  • DbProvider – this provider can be used to retrieve rewrite mappings from a SQL Server database table by executing a stored procedure;
  • FileMapProvider – this provider can be used to retrieve rewrite mappings stored in a text file;
  • FileContainsProvider – this provider can be used to check if any string in a text file is a substring of the provider’s input string.

Download the URL Rewrite Extensibility Samples from MSDN Code Gallery.

More Information

The following documentation about URL Rewrite 2.0 is available on IIS.net:

Also, visit the URL Rewrite Forum on IIS.NET if you have run into any problems when using the module or have questions or suggestions.

The post IIS URL Rewrite 2.0 – Release to Web appeared first on RuslanY Blog.

]]>
https://ruslany.net/2010/03/iis-url-rewrite-2-0-release-to-web/feed/ 34
URL Rewrite Module v2 – Release Candidate https://ruslany.net/2009/11/url-rewrite-module-v2-release-candidate/ https://ruslany.net/2009/11/url-rewrite-module-v2-release-candidate/#comments Mon, 09 Nov 2009 18:42:31 +0000 http://ruslany.net/?p=590 The URL Rewrite Module 2.0 – Release Candidate is available for download. The release contains functionality and stability improvements and it is believed to have a quality level suitable for production deployments. Overview Microsoft URL Rewrite Module 2.0 for IIS 7 is an incremental release that includes all the features from version 1.1, and adds … Continue reading "URL Rewrite Module v2 – Release Candidate"

The post URL Rewrite Module v2 – Release Candidate appeared first on RuslanY Blog.

]]>
The URL Rewrite Module 2.0 – Release Candidate is available for download. The release contains functionality and stability improvements and it is believed to have a quality level suitable for production deployments.

Overview

Microsoft URL Rewrite Module 2.0 for IIS 7 is an incremental release that includes all the features from version 1.1, and adds support for outbound response headers and content rewriting. More specifically, it can be used to:

  • Replace the URLs generated by a web application in the response HTML with a more user friendly and search engine friendly equivalent
  • Modify the links in the HTML markup generated by a web application behind a reverse proxy.
  • Fix up the content of any HTTP response by using regular expression pattern matching.
  • Modify HTTP request headers and IIS server variables.
  • Modify HTTP response headers

Install the URL Rewrite Module 2.0 – RC

To install the URL Rewrite Module 2.0 – RC, use the download links at the module’s home page at http://www.iis.net/extensions/urlrewrite.

Note:

  • If a previous version of URL Rewrite Module, such as v1.0 and v1.1, is already installed then it will be upgraded to the v2.0 RC
  • If a beta version of the URL Rewrite Module 2.0 is already installed, then it has to be uninstalled before installing v2.0 RC.

Changes since the beta release

Here are the new features and changes that were added to the module in the RC release. For the complete list of the URL Rewrite 2.0 features refer to Using URL Rewrite Module 2.0.

  • Rewriting of HTTP response headers. Outbound rewrite rules can be used modify any existing HTTP response headers or to set new ones.
  • Logging of rewritten URLs. The rewrite rules can be configured to log the rewritten URL in IIS W3C logs as opposed to logging an originally requested URL.
  • Evaluating HTTP response headers from rewrite rules. The rewrite rules now can access and evaluate the values in the HTTP response headers.
  • Allow list for server variables. To prevent distributed rewrite rules from accidentally or purposefully modifying IIS server variables that may affect security or runtime behavior of a web application the modifiable server variables now have to be explicitly added to the allow list.
  • HtmlEncode function. Outbound rewrite may often use an un-trusted data (e.g. query string or HTTP headers) to build a replacement string to insert into the HTTP response. In those cases the HtmlEncode function should be used to prevent insertion of client-side scripts into the response, which could result in cross-site scripting vulnerability.
  • Updated user interface in IIS Manager. The user interface has been significantly improved to better represent the module configuration and to simplify such common tasks as configuring of rewrite rules and rewrite conditions.
    URL Rewrite v2 - User Interface

Documentation:

Support

The post URL Rewrite Module v2 – Release Candidate appeared first on RuslanY Blog.

]]>
https://ruslany.net/2009/11/url-rewrite-module-v2-release-candidate/feed/ 5
Enable PHP Syntax Highlighting on IIS 7 https://ruslany.net/2009/10/enable-php-syntax-highlighting-on-iis-7/ https://ruslany.net/2009/10/enable-php-syntax-highlighting-on-iis-7/#comments Wed, 07 Oct 2009 04:57:49 +0000 http://ruslany.net/?p=557 This post describes how to configure IIS 7 to output syntax highlighted source code for PHP files stored on the web server or site. This feature may be useful for development environments when you want to quickly make the source code accessible to other team members. WARNING: Never attempt to do what is described below … Continue reading "Enable PHP Syntax Highlighting on IIS 7"

The post Enable PHP Syntax Highlighting on IIS 7 appeared first on RuslanY Blog.

]]>
This post describes how to configure IIS 7 to output syntax highlighted source code for PHP files stored on the web server or site. This feature may be useful for development environments when you want to quickly make the source code accessible to other team members.

WARNING: Never attempt to do what is described below on any internet accessible web site! Doing so will greatly compromise the security of your web application.

The HTTP requests for the PHP source code are usually identified by the “.phps” file extension, e.g. http://localhost/index.phps. You will need to configure IIS to understand and handle the HTTP requests with this extension. There are two options for that: to create an IIS handler mapping for “*.phps” or to use the IIS URL Rewrite Module.

Configuring IIS Handler Mapping

PHP executable supports a command line argument “-s” which is used to display color syntax highlighted source code of any PHP script. You can create a handler mapping for “*.phps” and use “C:\[path to PHP installation]\php-cgi.exe|-s” as the executable, e.g.:

Handler Mapping for PHPS extension

After that you will need to rename or copy the .php file to .phps file and then request it from a web browser.

Using IIS URL Rewrite Module

If you do not want to rename each .php file to .phps, you can use IIS URL Rewrite rule and a simple PHP script (as suggested by Pierre Joye). In the root directory of your web site create a file called highlighter.php and put the following code inside:

<!--?php
if ( isset( $_GET['file'] ) ) {
  $file = filter_input( INPUT_GET, 'file', FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_HIGH );
  highlight_file( $file );
}
?-->

After that add the following rewrite rule to the web.config file located at the root directory of your web site:

<rewrite>
<rules>
  <rule name="PHP Source Code" stopProcessing="true">
   <match url="(.*\.php)s$" />
   <conditions>
    <add input="{DOCUMENT_ROOT}\{R:1}" matchType="IsFile" />
   </conditions>
   <action type="Rewrite" url="highlighter.php?file={R:1}" appendQueryString="false" />
  </rule>
</rules>
</rewrite>

Now, if you request any url that has an extension .phps the highlighted source code will be returned in the response, provided that the corresponding .php file exists under the web site’s root directory.

Result of requesting a PHPS file

The post Enable PHP Syntax Highlighting on IIS 7 appeared first on RuslanY Blog.

]]>
https://ruslany.net/2009/10/enable-php-syntax-highlighting-on-iis-7/feed/ 2
URL Rewrite Module 2.0 for IIS 7 – Beta https://ruslany.net/2009/07/url-rewrite-module-2-0-for-iis-7-beta/ https://ruslany.net/2009/07/url-rewrite-module-2-0-for-iis-7-beta/#comments Thu, 16 Jul 2009 22:46:11 +0000 http://ruslany.net/?p=438 Today IIS team has released the URL Rewrite Module 2.0 for IIS 7 – Beta. This is an incremental release that includes all the features from version 1.1, and adds support for outbound response rewriting. More specifically, it can be used to: Replace the URLs generated by a web application in the response HTML with … Continue reading "URL Rewrite Module 2.0 for IIS 7 – Beta"

The post URL Rewrite Module 2.0 for IIS 7 – Beta appeared first on RuslanY Blog.

]]>
Today IIS team has released the URL Rewrite Module 2.0 for IIS 7 – Beta. This is an incremental release that includes all the features from version 1.1, and adds support for outbound response rewriting. More specifically, it can be used to:

  • Replace the URLs generated by a web application in the response HTML with a more user friendly and search engine friendly equivalent
  • Modify the links in the HTML markup generated by a web application behind a reverse proxy.
  • Fix up the content of any HTTP response by using regular expression pattern matching

Install the URL Rewrite Module 2.0 Beta

wpibadgesilver

or, download:

Note:

  • URL Rewrite v1.0 and v2.0 cannot be installed side-by-side.
  • URL Rewrite v1.1 and v2.0 cannot be installed side-by-side.
  • If URL Rewrite v1.0 or v1.0 is already installed, uninstall it before proceeding with installing URL Rewrite Module v2.0 Beta.

New Features

URL Rewrite Module 2.0 includes the following key features:

  • Rules-based response rewriting engine. Outbound rules are used to express the logic of what to compare parts of the response with and what to do if comparison was successful. Web server and site administrators can use outbound rules to define complex response rewriting logic.
  • Rewriting within the content of specific HTML tags. Instead of scanning the entire response for a particular match, the rule can be configured to look only inside of certain HTML tags, such as <a>, <img>, etc. That way the pattern is greatly simplified and the process of applying the rule to the content is much faster comparing to applying the pattern to the entire response.
  • Pre-conditions for outbound rules. Applying rewrite rules on every response is an expensive operation and is not necessary in majority of the cases. Pre-conditions are used to check the response metadata to determine if outbound rules evaluation should be applied.
  • Setting of server variables and HTTP headers. Various IIS server variables and HTTP request headers can be set by using rewrite rules.
  • Tracking capture groups across rule conditions. The conditions back-referencing logic in URL Rewrite 1.1 worked only against the last matched conditions. In v2 it is possible to configure back-referencing logic to work against all matched conditions.
  • Logging of rewritten URLs. The module can be configured to log the rewritten URL in IIS W3C logs as opposed to logging an originally requested URL.

More information

Use the following links to get more information about URL Rewrite Module 2.0 Beta:

Also, be sure to visit the URL Rewrite Forum on IIS.NET if you have run into any problems when using the module or have questions or suggestions.

The post URL Rewrite Module 2.0 for IIS 7 – Beta appeared first on RuslanY Blog.

]]>
https://ruslany.net/2009/07/url-rewrite-module-2-0-for-iis-7-beta/feed/ 7
IIS 7 URL Rewrite Module support in WordPress 2.8 https://ruslany.net/2009/05/iis-7-url-rewrite-module-support-in-wordpress-28/ https://ruslany.net/2009/05/iis-7-url-rewrite-module-support-in-wordpress-28/#comments Sat, 16 May 2009 07:41:05 +0000 http://ruslany.net/?p=393 I am pleased to let everyone know that WordPress development community has added a built-in support for IIS 7 URL Rewrite Module in the upcoming WordPress 2.8 release. Starting with version 2.8 the Permalink Settings page will allow you to easily configure “Pretty Permalinks” URL structure when WordPress is running on IIS 7 with URL Rewrite Module v1.1 installed. … Continue reading "IIS 7 URL Rewrite Module support in WordPress 2.8"

The post IIS 7 URL Rewrite Module support in WordPress 2.8 appeared first on RuslanY Blog.

]]>
I am pleased to let everyone know that WordPress development community has added a built-in support for IIS 7 URL Rewrite Module in the upcoming WordPress 2.8 release. Starting with version 2.8 the Permalink Settings page will allow you to easily configure “Pretty Permalinks” URL structure when WordPress is running on IIS 7 with URL Rewrite Module v1.1 installed.

Here is how the process of updating Permalinks structure will look like in WordPress 2.8 on IIS 7:

  1. Go to Settings –> Permalinks page and choose the permalink structure that you prefer:
    Permalink Settings page with Pretty Permalinks
  2. After clicking on “Save Changes” button the generated rewrite rule will be displayed with the instructions on how to update the web.config file manually:
    Permalink Settings Page with rewrite rule example
  3. Now you can copy the the given XML and put it into the web.config file inside of /<configuration>/<system.webServer>/<rewrite>/<rules> element and that’s it!
  4. Alternatively – instead of manually editing the web.config file you can have WordPress to update it automatically for you. To do that, temporarily grant WordPress write access to web.config file and click on “Save Changes” again. WordPress will add its rewrite rule into the proper location inside of the web.config file. Do not forget to revert the write permission on web.config file after the rule has been saved.

If you want to try this functionality, as well as all the other new features in the upcoming WordPress 2.8 release, you can download the latest nightly build. Also, pretty soon the 2.8 beta will be available.

Thanks to the WordPress development community for adding this functionality! Specifically, big thanks to peaceablewhale, Denis-de-Bernardy, hakre, sivel and ryan for directly working on the patch and contributing to it in many different ways: testing, code reviewing, cleaning up the code and checking it in.

The post IIS 7 URL Rewrite Module support in WordPress 2.8 appeared first on RuslanY Blog.

]]>
https://ruslany.net/2009/05/iis-7-url-rewrite-module-support-in-wordpress-28/feed/ 65
URL Rewrite Module 1.1 for IIS 7 https://ruslany.net/2009/04/url-rewrite-module-11-for-iis-7/ https://ruslany.net/2009/04/url-rewrite-module-11-for-iis-7/#comments Mon, 20 Apr 2009 18:45:34 +0000 http://ruslany.net/?p=322 Today IIS team has released the URL Rewrite Module 1.1 for IIS 7. This is an incremental update that contains fixes to the bugs found since the URL Rewrite Module v1.0 has been released in November 2008. If you have version 1.0 installed (file version of rewrite.dll is 7.1.315.0), it is highly recommended you upgrade … Continue reading "URL Rewrite Module 1.1 for IIS 7"

The post URL Rewrite Module 1.1 for IIS 7 appeared first on RuslanY Blog.

]]>
Today IIS team has released the URL Rewrite Module 1.1 for IIS 7. This is an incremental update that contains fixes to the bugs found since the URL Rewrite Module v1.0 has been released in November 2008. If you have version 1.0 installed (file version of rewrite.dll is 7.1.315.0), it is highly recommended you upgrade to version 1.1.

Install the URL Rewrite Module 1.1 for IIS 7 today!

Install URL Rewrite with Web PI

or, download:

Upgrade from URL Rewrite Module 1.0 release

If you have URL Rewrite Module version 1.0 installed, the installation package upgrades it to version 1.1. All rewrite rules in applicationHost.config and web.config files are preserved during upgrade process.

Important: If the IIS services are not stopped before you perform the upgrade, you will be prompted to restart your computer. To upgrade without restarting your computer, use the following command to stop the IIS service:

net stop was /y & net stop wmsvc

After the upgrade is completed, run this command:

net start w3svc

If Web Management Service was running before installing URL Rewrite then start it by using the command below:

net start wmsvc

Using URL Rewrite Module 1.1 with Application Request Routing 1.0 and 2.0 Beta

URL Rewrite Module 1.1 is fully compatible with Application Request Routing 1.0 and 2.0 Beta.

Bug fixes since URL Rewrite Module 1.0 release

The following important bug have been fixed in URL Rewrite Module 1.1:

  1. Installation of module failed on Windows 7 Beta and Windows Server 2008 R2 Beta.
  2. %{REQUEST_URI} references in mod_rewrite rules were translated incorrectly. Now, when you use the mod_rewrite rules import feature, the references to %{REQUEST_URI} will be converted to {URL}.
  3. {SCRIPT_NAME} server variable was set incorrectly when evaluating rewrite rules.
  4. Match types “IsFile” and “IsDirectory” did not work with file paths that contained forward slashes (e.g. “C:/inetpub/wwwroot/iisstart.htm”).
  5. Distributed rules defined inside of <location> tag were not read when rule set contained <clear /> element.
  6. Overly aggressive disabling of IIS kernel mode cache. The URL Rewrite Module used to disable kernel mode cache if any rule in a rule set had a condition that used cache unsafe server variable. The cache was disabled regardless whether the requested URL matched the rule pattern or not. In version 1.1, the module will disable kernel cache for a particular request only if that request’s URL matches the rule pattern and that rule uses cache unsafe server variable.
  7. The disabling of kernel mode cache took effect only when using rules with action type “Rewrite”. In version 1.1, the IIS kernel mode cache will be disabled for rules that uses unsafe server variables, regardless of the rule’s action type.
  8. Module was failing to parse a back-reference expression when the last error code was not reset.
  9. Un-encoded Unicode characters in query string caused URL rewrite module to fail.

More information

For more information about URL Rewrite Module and other IIS extensions visit the IIS Extensions page.

Also, be sure to visit the URL Rewrite Forum on IIS.NET if you have run into any problems when using the module or have questions or suggestions.

The post URL Rewrite Module 1.1 for IIS 7 appeared first on RuslanY Blog.

]]>
https://ruslany.net/2009/04/url-rewrite-module-11-for-iis-7/feed/ 9