Skip to content

Instantly share code, notes, and snippets.

@mvalipour
Last active March 16, 2016 09:11
Show Gist options
  • Select an option

  • Save mvalipour/480945c336447721cb51 to your computer and use it in GitHub Desktop.

Select an option

Save mvalipour/480945c336447721cb51 to your computer and use it in GitHub Desktop.
Pre-Authenticated URLs with IIS URL Rewriting

This configuration allows having pre-authenticated URLs.

-- i.e. mapping /auth/xyz/some/resource to /some/resource?token=xyz

NOTE: This DOES preserve other querystrings on the URL.

pre-authenticated urls were useful for our elasticsearch reverse proxy to allow us use authentication with sense.

<system.webServer>
<rewrite>
<rules>
<rule name="pre-authenticated-urls" stopProcessing="true">
<match url="auth\/([^\/]+)(.*)" />
<action type="Rewrite" url="{R:2}?token={R:1}" appendQueryString="true" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment