Skip to content

Setting Up Redirects

In order to setup a redirect on Patr to redirect your URL to another URL, you can use Patr's Managed URL feature to create a redirect URL.

Prerequisites: What you'll need

  • A Patr account (You can sign up for one here)
  • A Domain added on Patr and Verified

Creating a Managed URL

In order to create a Managed URL, navigate to Infrastructure in the side navigation, and click on Managed URLs.

Screenshot of Sidenav with managed urls selected

On the Managed URLs screen, click on the Create Managed URL button.

Screenshot of create managed url button

In the create Managed URL section, enter the following values:

  • Subdomain: The subdomain of the Managed URL you want to create. For example, if you want to create a redirect from https://blog.example.com to https://medium.com/blog, enter blog as the subdomain. If you want your Managed URL to trigger for https://example.com (the root domain), then enter @ as the subdomain.
  • Domain: A verified domain that has been added to your account. You can learn more on adding a Domain to Patr here. In the case of https://blog.example.com, choose example.com as your domain.
  • Path: The sub-path to which this Managed URL will respond to. If you want your Managed URL to serve on the default path, you can simply use / as the default value.
  • Type: Select the Type as Redirect, and enter the URL you want to redirect to. In our example, this would be medium.com/blog. Patr will automatically redirect you to the HTTPS version of the webpage. In case you have a legacy application that does not support HTTPS and requires to be redirected to an HTTP version, you can select the HTTP Only checkbox.

Screenshot of create Managed URL screen with redirect prefilled

Patr will always redirect you with a HTTP 307 Temporary Redirect. In case you want to use a more permanent redirect, you can select the Permanent Redirect checkbox. This will make your Managed URL redirect with a HTTP 308 Permanent Redirect instead. This is useful for SEO when you want search engines to know that your URL has been permanently moved to a new location. It is also better for performance since browsers will automatically cache permanent redirects and will automatically redirect to the new URL. However, since it might take a long time for browser cache to be invalidated, the default is set to Temporary Redirect, and a Permanent Redirect can be enabled explicitly.

Note: While most Managed URLs are triggered if the request URL begins with the Managed URL's path, for redirects, however, the Managed URL is only triggered when the request path is exactly equal to the Managed URLs path. For example, if a Managed URL is redirecting https://example.com/blog to https://medium.com/example, it will only trigger on requests made to https://example.com/blog and not to https://example.com/blog/first-blog.

Configuring your Managed URL - Pointing your DNS

Once a Managed URL is created, Patr will respond to the Managed URL whenever a request is sent to it. However, in order for Patr to receive requests sent to it, the DNS needs to be pointing to the Managed URL.

Pointing your DNS depends on if your domain's nameservers are hosted by Patr or externally.

Pointing your DNS for Patr hosted nameservers

If your domain's nameservers are hosted by Patr, you can simply click on the Configure button next to the Managed URL and Patr will automatically create a DNS record for you, and your Managed URL will be running in a few seconds.

Screenshot of Managed URL configure button Screenshot of Managed URL configure button for internal domains, with the modal for "create DNS record?"

Pointing your DNS for external nameservers

If your domain's nameservers are hosted externally, you can click on the Configure button, and you will get instructions on creating the DNS record. Login to your domain registrar (this is usually where you bought the domain from). Select your domain, and add the following DNS record:

Record Type Record Name Record Value TTL
CNAME <The subdomain of your Managed URL (or @ for root)> ingress.patr.cloud Auto (leave at default)

Screenshot of Managed URL configure button Screenshot of Managed URL configure button for external domains, with the modal with instructions

Once the DNS record is added, the Managed URL will become configured within an hour or two. You can also click on the Configure button to configure the Managed URL manually.

For instructions on adding DNS records for major domain registrars, see below:

Further Reading

Adding a Domain on Patr
Creating Managed URLs
Managing your DNS on Patr