Skip to Content

URL Rewriting

Overview

Some environments utilize URL rewriting. A typical use case for URL rewriting maps the web root:

http://example.com/

To a sub-directory:

http://example.com/Vinyl/

From the browser's perspective, Vinyl is hosted directly beneath the web root. From the server's perspective, Vinyl's hosted in a sub-directory. This incongruity causes problems, particularly with cookies. Browsers take into account the path when determining whether or not to send a cookie to the server.

Vinyl has support for automatically detecting and correcting for URL rewriting. By default, Vinyl will check for the X-Original-URL header. This header is typically set by URL rewrite modules. If present, Vinyl will use the header to determine the correct path.

Settings

Name Description Example
OriginalUrlHeader URL prior to any rewriting. X-Original-URL

Example Configuration

<appSettings>
    <add key="OriginalUrlHeader" value="X-Original-URL" />
</appSettings>

Amazon Web Services

In an Amazon Elastic Beanstalk environment, URLs are rewritten by default using the IIS URL Rewrite Module. The IIS URL Rewrite Module sets the X-Original-URL header. No additional configuration is necessary.