Skip to content

How to setup subdomainless URLS

Kartones edited this page Apr 7, 2015 · 12 revisions

Intro

Historically, CartoDB URLs were based on a username.cartodb.com/PATH schema. When Multiuser accounts were introduced, an alternate schema organizationname.cartodb.com/u/username/PATH was built alongside the "classic" one. Both schemas introduce some problems for opensource and/or custom installs of the platform, as they require DNS changes each time a new user or organization is added.

Subdomainless urls are the answer to this problems. Modifying some configuration settings, any CartoDB installation can be setup to work with a new schema, cartodb.com/user/username/PATH.

This page details the steps to make it work and the limitations it has.

Configuration changes

  • For a default installation, app_config.yml contains this relevant values:
  session_domain:     '.localhost.lan'
  subdomainless_urls: false
  • To activate subdomainless urls, change to (notice the removed starting dot from session_domain:
  session_domain:     'localhost.lan'
  subdomainless_urls: true

As with other configuration changes, Rails application must be restarted to apply them.

  • Non-default HTTP and HTTPs ports can also be configured here for REST API calls, with the following app_config.ymlattributes:
  # nil|integer. HTTP port to use when building urls. Leave empty to use default (80)
  http_port:     
  # nil|integer. HTTPS port to use when building urls. Leave empty to use default (443)
  https_port:    

Limitations

If you leave the dot at session_domain having subdomainless urls, you will be forced to always have a subdomain. Any will do, but must be present. If you remove the dot it will work as intended without any subdomain.

When subdomainless urls are used, organizations will be ignored from the urls. In fact, typing whatever.cartodb.com/user/user1 and cartodb.com/user/user1 is the same. The platform will replicate the sent subdomain fragment to avoid CORS errors but no existing organization checks will be performed. You should be able to use them, assign quota to the organization users, etc.

Clone this wiki locally