Does Platform.sh support subdomains and Let's Encrypt for them?
The information in this post is accurate as of the published date . Please make sure to check any linked documentation within the post for changes/updates.
I’m looking to add 500+ subdomains to my application on Platform Professional. How do I set them up in my routes.yaml
file? Is there a limit to the number of subdomains I can add there? How do I set up certificates for them?
-
While Platform.sh does support wildcard routes to generate the number of subdomains you are looking for, we do not currently support Let’s Encrypt for those wildcards.
To create the wildcards, you can simply prefix the route with a star (
*
), for example*.{default}
, and HTTP request towww.{default}
,blog.{default}
,us.{default}
will all get routed to the same endpoint.As for certificates, Platform.sh does support custom certificates, such as a Comodo SSL wildcard certificate.
0 -
Hi, yes there is a limit and to know what the limit is requires diving into implementation details a bit.
The way that platform.sh manages certain aspects of configuration within the application containers is with environment variables. You are probably familiar with the
PLATFORM_RELATIONSHIPS
variable used to set up connection strings for that environments database, etc but there is another variable namedPLATFORM_ROUTES
that is essentially a JSON representation of your environments routes. It’s base64 encoded just like the RELATIONSHIPS variable, so decoded it looks something like this -web@35ztu3ywra3e7usbmuowjb6nim:~$ echo $PLATFORM_ROUTES | base64 -d | json_pp { "http://www.feature-sidebar-um4m5by-26w5v7umv77iu.us-2.platformsh.site/" : { "original_url" : "http://www.{default}/", "id" : null, "to" : "https://www.feature-sidebar-um4m5by-26w5v7umv77iu.us-2.platformsh.site/", "primary" : false, "restrict_robots" : true, "type" : "redirect", "http_access" : { "basic_auth" : {}, "addresses" : [] } }, "https://feature-sidebar-um4m5by-26w5v7umv77iu.us-2.platformsh.site/" : { "restrict_robots" : true, "original_url" : "https://{default}/", "primary" : false, "http_access" : { "basic_auth" : {}, "addresses" : [] }, "attributes" : {}, "type" : "redirect", "tls" : { "min_version" : null, "client_authentication" : null, "client_certificate_authorities" : [], "strict_transport_security" : { "include_subdomains" : null, "preload" : null, "enabled" : null } }, ...
So here’s the deal - there is a limitation to how large a Linux environment variable can be. The more routes (domains) you add to your project, the larger this variable will be. It’s kind of impossible for me to say exactly how many domains it can fit because it’s really more about “how many bytes does this string take up?” but I think 500 is probably going to be over the limit.
0
Please sign in to leave a comment.
Comments
2 comments