HTTPS redirect from root domain (i.e. apex or 'naked') to 'www' subdomain without browser throwing up? -


dns a-records require ip address hard-coded application’s dns configuration

...which heroku recommends avoiding. heroku suggests 2 workarounds:

...using dns provider supports cname-like functionality @ apex, , using subdomain redirection`.

my question revolves around latter option (because former isn't supported dreamhost afaik):

is possible redirect root (i.e. apex or 'naked') domain 'www' subdomain https requests without browser throwing up?

heroku thinks not:

...applications requiring ssl encryption should use alias/aname configuration on root domain. subdomain redirection cause browser error when root domain requested on ssl (i.e. https://example.com).

...but i'm hoping that's incomplete (or incorrect) statement.

clarification update:

the real issue redirecting apex 'www' typing https://example.com directly browser raise certificate warning. sure, it's edge case, not small one.

solution update:

i solved problem dnsimple. (didn't have transfer domain!)

i believe easydns offers similar feature, surprised find other domain hosting companies don't.

there 2 separate interdependent levels of indirection consider here. first ip address dns name resolves to. second server on ip address does.

remember when type url browser, first thing happens dns lookup. usually, that's handled operating system – not browser itself.

so browser ask os, "what address of example.com?" os record, , if gets cname, that record, until finds a record. os responds browser answer.

your browser opens tcp connection ip address:

  • if http:// url, connects port 80, issues http request.
  • if https:// url, connects port 443, establishes tls/ssl connection (which means validating certificates), then issues http request on secure channel.

only @ point can http redirection happen. browser sends request (get /, , server can respond 301 other url.

understand "subdomain redirection" services offered registrars nothing more regular http server issues 301s. when opt registrar's redirection option, set a record of domain's apex server control, , server tells browsers go www.example.com.

since registrars don't allow upload ssl certificate redirection server, browsers cannot establish necessary secure connection server, , therefore never issue http request. thus, requests https​://example.com fail.

so why can't cname apex? it forbidden.

the domain system provides such feature using canonical name (cname) rr [record resource]. cname rr identifies owner name alias, , specifies corresponding canonical name in rdata section of rr. if cname rr present @ node, no other data should present; ensures data canonical name , aliases cannot different. rule insures cached cname can used without checking authoritative server other rr types.

the spec requires cname record record given (sub)domain. @ odds requirement of having soa record on apex. (there efforts out there change specs allow cname , soa coexist, there still many broken smtp implementations confused cname on domain.)

you have following options ssl working on apex:

  • use third-party service supports ssl on redirect server. you'll pay this. here's 1 service. would not recommend route, since takes control of reliability out of hands, , requires hand on keys ssl certificate may or may not trustworthy.
  • run own redirection server. since apex requires a record, you'll need static ip, services heroku , aws' elb not provide. if you're in cloud environment, difficult (if not impossible) guarantee reliability. on plus side, retain control of ssl keys.
  • use dns host allows set alias. point alias heroku domain/elb/whatever. best option.

an alias not technically type of dns record. instead, special configuration on dns host side returns a record result of lookup. in other words:

  1. your os issues dns request example.com dns host.
  2. your dns host reads internal alias configuration, , issues dns request domain. if have alias set example.herokuapp.com, a record of domain.
  3. the dns host returns simple a record ip(s) got alias lookup.

with alias record, point apex same cloud load balancer www domain cnamed to. assuming you've set ssl on www domain, naked domain work fine. @ point, it's choice whether app issues redirect, or serves content directly on naked domain.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -