Vanity redirects can be difficult to manage as there are multiple configuration elements in play. In this article, will review everything you need to know to manage them.
Complex redirects
Your domains
First, review your domain list. Domain list affects your default
environment. You can view those in your project settings. From the console default page, click settings, then domains on the left-hand side. You can also use platform domains
CLI command.
Your default domain will replace the {default}
value in the .platform/routes.yaml
and {all}
will generate routes for all your domains. If you have dedicated hardware, the {all}
behavior differs as it excludes your default domain.
Understanding routes
Now that you have your domains in mind, let’s review your .platform/routes.yaml
. To review, use the platform repo:cat .platform/routes.yaml
and platform routes
commands. Both of those will help you understand your global configuration.
Another useful command is platform route:get
which will output all the settings and configuration for a single route. This includes URLs, so it’s helpful to understand what URLs are used with the route configuration.
Now comes Nginx
Those settings are used in our automation to compile the resulting nginx.conf in your environment which is what returns the HTTP location headers which requests might follow. Run find /etc/platform -name 'nginx.conf'
to find it. If you’re on dedicated hardware it will be the one in /etc/platform/${app}/nginx.conf
otherwise it will be /etc/nginx/nginx.conf
.
Once you locate the nginx.conf
you can simply use less nginx.conf
and search your domains or redirect rules. This will show you the resulting config for your settings which is the best way to understand how to configure your redirects.
Docs and tools
To better understand how to manage redirects , you can review our related documentation:
And here’s a simple GUI tool to help investigate redirect:
Vanity domain redirects
While our PaaS support domain redirects, we assume those are meant to be a requirement for your software to function properly and are actually used by your app. If you configure vanity domain redirects you’ll eventually run into problems.
Some technologies we use in our stack, mainly Fastly, Let’s Encrypt and our proprietary software, have limitations that limit the number of domains you can use. While those limitation are different for each software, if you need more than 75 domains you’ll likely hit them.
If you hit those limitations, here are the solution we recommend.
Self-service redirect management
Our recommended solution is to subscribe to a small grid hosted plan, with minimal user and storage.
Those plans are cheap and fully self-service. Your developers will be able to fully manage about 75 to 100 domains.
Using another external service
Using a third party service can also be the proper solution for your projects.
Here’s some that can help you: