-
Notifications
You must be signed in to change notification settings - Fork 649
Domainless URLs Requirements doc
Kartones edited this page Apr 7, 2015
·
1 revision
Usage Doc: Wiki page
###Intro###
We wish to support disabling (optionally or enforced) subdomains in the url hostnames.
First approach (PR) was going into too a complex path just for supporting existing /u/xxxx
multiuser urls, while that is not mandatory.
###Current URL formats###
USERNAME.cartodb.com/
ORGANIZATION.cartodb.com/u/USERNAME
###Proposal that would keep compatibility###
cartodb.com/user/USERNAME
-
ORGANIZATION.cartodb.com/user/USERNAME
(^1) - Config flag to enable/disable this format (for development, custom-installs, etc., but not for cartodb.com)
2nd round:
-
ORGANIZATION/cartodb/user/USERNAME
(^1) (would require routes.rb changes to have an additional optional param)
(^1) If
/user/
is present, subdomain will be silently ignored.
###Current MVC flow###
- If there's an incoming request param
user_domain
, subdomain is checked from there, else is obtained from request.host (substractingsession_domain
first, soUSERNAME.cartodb.com
would becomeUSERNAME
).user_domain
equals/u/USERNAME
- Then, code (at a few places, sadly is not as clean as should) checks if
user_domain
is a proper user and belongs to an organization.- If it does checks the org present at request.host. If not valid redirects to valid one.
- Code also compares
user_domain
withcurrent_user
, and if different retrieves the User belonging touser_domain
and stores it ascurrent_viewer
. This is done when you have a session A and are browsing pages of user B.
###Backend changes that proposal requires### Probably a few could be salvaged from URL Rewrites branch
- Refactor of CartoDB class, both to remove stuff that doesn't belongs there and to add
- Refactor of controller code
- Small changes to authentication methods to make sure are always sending proper usernames, etc. for validation.
- Warden sessions might be affected as they rely now on hostname for the authentication realm/scope (user A's realm is
A.cartodb.com
, socartodb.com/user/USERNAME
wouldn't work out-of-the-box) -
UsersController.get_authenticated_users()
changes
- Warden sessions might be affected as they rely now on hostname for the authentication realm/scope (user A's realm is
- Refactor of manual calls to config values regarding subdomains
- Refactor of manual handcrafted urls
- Error of missing user and redirections handling
- Re-adding support for defining http port, and adding another param for https
- Making new format optional or mandatory (needs most of previous work before)
-
base_url
related changes. Internally will use abase_url_template
like{user}.cartodb.com
, which will be replaced by decorators, etc. just before sending to frontend code. - Oembed controller low-level tests and changes to use CartoDB url creation and handling functions whenever possible
- Extract User model methods that operate with URLS to some service object or related class to remove logic from the already hugely heavy model.
-
public_url
anddomainless_public_url
from URL rewrite were a good start, but better to fully encapsulate logic. Value object CartoDB::URL is a nice looking solution, could be queried forhas_subdomain?
,is_domainless?
etc. if needed and just doing a.to_s
or.url
would return the wanted "simple string url" - Fixes for Visualization::Member
###Frontend changes that proposal requires###
- JS refactor to send
base_url
(probably now via.config
instead of.user_data
) - Support for
sql_api_template
andmaps_api_template