Skip to Content

Security Provider - Rewrite URL

Vinyl web clients and servers must agree on the Vinyl application URL. This is necessary for handling of cookies and client-side redirects such as those that take place during the authentication process. Reverse proxies can modify the request URL in-flight. The Rewrite URL provider can be used to restore a URL that has been rewritten by a reverse proxy.

The Rewrite URL provider matches the following request URL components:

  • Scheme - HTTP or HTTPS
  • Host - example.com
  • Port - 80, 443

Matching URLs are rewritten. Note that only the scheme, host name and port components can be rewritten: the path cannot be rewritten. Since paths are case-sensitive, they cannot be reliably restored.

Configuration

The Rewrite URL provider must be manually registered. The Rewrite URL provider should be registered before any other providers.

Parameters

Parameter Default Value Description
MatchUrl The URL specification against which the request will be tested. Only the scheme, host and port are considered.
RewriteUrl The URL to which the request will be rewritten. Only the scheme, host and port are modified.
DetectReverseProxy False
  • When enabled, Vinyl will inspect the request to determine if a reverse proxy may have modified the URL. Currently, Vinyl looks for the presence of the X-Forwarded-For header.
  • Set this property to True if users can access the Vinyl application using the MatchUrl without going through the reverse proxy. This usually suggests a split DNS configuration.

Troubleshooting

To troubleshoot why a URL may or may not be rewritten, set the Vinyl logging level to Trace. Make an HTTP request to Vinyl (usually one that goes through the reverse proxy). Then, review the logs. You should see log entries in the following form:

HTTP request URL components: scheme=http, host=example.com, port=80
Rewritten HTTP request URL components: scheme=https, host=example.com, port=443