URL rewriting and alias domains - rebrandly/rebrandly-express GitHub Wiki

Consider a valid URL:

What is a URL (source: https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL)

During a redirection via Rebrandly aliasing, the domain name part (in the image, it is www.example.com) has to be replaced by the alias domain.

Rebrandly will setup and provide a custom alias domain for the branded domain. If your web server is running under "acme.com", you can add "acme.com" to your Rebrandly account, and Rebrandly will generate an alias for it (a subdomain of rebrandly.cc domain name). An alias comes similar to this: xxxxxxxx.rebrandly.cc.

The middleware will then re-write the incoming HTTP request:

  1. Replace the domain name with the alias domain
  2. Enforce HTTPS protocol (force port 443 if any other port was specified)
  3. Preserve all other URL components (except URL Fragment/Anchor, which is not available on server side) so that they make appearance in the rewritten URL

and will return the client a HTTP 302 Response (Temporary Redirect) having as Location header the rewritten URL.