My configuration is as follows:
NameCheap has Cloudflare nameservers only.
Openshift has domain alias changed from app-account.rhcloud.com to domain.com.
CloudFlare DNS settings has no A records, but two CNAME records: domain.com is an alias of app-account.rhcloud.com and www is an alias of domain.com.
CloudFlare Page Rules forward http://www.domain.com/* to http://domain.com/$1
These were all configured based on the solutions found online that have worked for others. My domain.com is accessible without issue, but www.domain.com provides this error:
I'm obviously missing something. Help would be greatly appreciated.
just FYI: you can have more than one alias even on free plan with OpenShift. Just go to alias list of you app and you can add another alias - url is: https://openshift.redhat.com/app/console/application/xxxxx-yourapp/aliases
Update: I stand corrected. See the chosen answer for the use of aliases which is a much better solution.
It seems the fix for this was rather simple. The problem was that the www.domain.com needs exist in OpenShift. Because my account is the free tier, OpenShift did not provide me an option to add another domain.
To mimic that, in OpenShift I added another application: PHP 5.4 with the domain alias www.domain.com replacing app-route-account.rhcloud.com.
Then in CloudFlare, I changed www is an alias of domain.com to www is an alias of app-route-account.rhcloud.com.
And, all is well. :)
If I was using a premium OpenShift account, I could have just added another domain to the first application, as www.domain.com. I hope this can help someone.
Related
I'm trying to find a current, up to date answer for setting up naked domain with Godaddy and Heroku SSL. My goal is for all pages to land on a secure page at https://www.example.com
https://www.example.com does go to a secure page.
example.com goes to an insecure page.
https://example.com does not work.
My current set up is as follows:
In heroku settings:
Domain Name | DNS Target
example.com | example.com.herokudns.com
www.example.com | www.my-domain.herokudns.com
Go Daddy Settings:
CNAME | www | www.example.com.herokudns.com
Forwarding settings:
Forward to: https:// | www.example.com
Yeah, it's a pretty stupid issue that some of the big DNS manager providers out there still have. The way to solve it is to have a server with an SSL certificate installed, and then point your naked domain to that static IP. The server then will redirect to the "www" version of your domain, which is now served under SSL by Heroku. Tedious.
If you don't want to do all that, just use https://www.nakedssl.com, which does exactly that – but automated (and for free for one domain).
Disclaimer: I'm part of the team that created NakedSSL, but I hope you take this as help and not as self-promotion. As explained above, the problem is as easy as tedious to solve, and I think NakedSSL is a pretty straight forward workaround.
Root domains on Heroku require the use of ALIAS ANAME or FLATTENING records.
Unfortunately, a number of popular DNS hosts such as GoDaddy, Bluehost, Google Domains, OVH, Hostinger and others do not support these types of records. Many of these Providers will tell you there is no such thing as ALIAS, ANAME or FLATTENING Records and many of these providers will tell you to set an A Record instead, however;
A Records do not work with Heroku for routing
A Records require static IP Addresses and static IP Addresses do not work with Heroku for routing, because Heroku (and many other cloud platforms) use dynamic IP's.
Instead, you can either:
Not use a naked domain and just use your www sub domain
Redirect/ Forward your HTTP root domain to your www sub domain. This won't work for your HTTPS root domain though
Use an Alternate DNS Provider. Heroku recommends the following: https://help.heroku.com/NH44MODG/my-root-domain-isn-t-working-what-s-wrong
Solved it.
Best way to get SSL set up is to use this package which automatically makes every page on your app SSL. Fantastic package. https://www.npmjs.com/package/force-ssl-heroku
Getting the naked domain set up with Godaddy easily: Set forwarding to your domain: https://www.my-domain.com. This will redirect non www to the correct place. :)
I believe naked subdomain or wildcards are not supported by heroku automated certs because of the let's encryption restrictions. So you need to set up a subdomain everytime you want to use Heroku's automatic certs.
ALSO VERY IMPORTANT! Don't forget to remove or edit any unsercured links to external assets. Otherwise browsers will jugde the page with those links unsecured as described in the Modzilla support page about mixed content.
I want to redirect a subdomain of a domain I have on CloudFlare, to a Google Calendar (HTML/embed version).
I assumed I needed to use Page Rules to do this, which I have done by following CloudFlare’s documentation. However just following these instructions did not work for me. Apparently I need to add the subdomain to my DNS records on CloudFlare, but I don’t know how to set this up correctly since I have no server or IP to point it to (or I’m just confused as to why I need to even point it to something when I just want to forward a URL).
As mentioned I have no server to point it to – and thus can’t use a .htaccess solution – so don’t know what record type I should be using to use to just have the redirect working
I've had some success just using google.com as the CNAME record, then using a Page Rule to redirect everything on that domain. Because CloudFlare changes the DNS entry to its servers anyway (when you do the orange cloud thing) nobody will know.
I don't know if you could do that directly from cloudflare, but you can solve this using your hosting.
Point subdomain to your hosting server sub IN A 1.2.3.4 via cloudflare
Create sub.domain.com on you hosting
Place redirection script in index file in subdomain sub.domain.com document root:
<?php
header( "Location: http://docs.google.com/your-url-and-so-on" ) ;
?>
"subdomain to my DNS records on CloudFlare, but I don’t know how to set this up correctly since I have no server or IP to point it to"
This doesn't make much sense. A subdomain has to point to a record of some sort (A record or CNAME), so the subdomain wouldn't resolve without a record type of some sort. In order for a PageRule to work, two things have to happen:
The record has to be in your DNS settings.
The record has to have our proxy running over it.
It might be easier to figure out with the actual subdomain in question & what you're trying to forward to specifically.
So CloudFlare does support this through PageRules, you just need to get the URL correct.
Just trying to create an web application, clients can create their own instance of the app, so I created a wildcard subdomain in CPanel, checked VirtualHosts and the A record in the DNS, all fine.
Now when I go to "client1app.domain.tld" it works, takes me to the clients app, but when that client creates a cname "app.clientdomain.tld" to "client1app.domain.tld", I get redirected to cPanels "Default Web Site Page".
I double-checked everything.
App DNS:
*.domain.tld. 3600 IN A x.x.x.x
Customer DNS
app.clientdomain.tld. 3600 IN CNAME client1app.domain.tld
App VirtualHost:
ServerName _wildcard_.domain.tld
ServerAlias *.domain.tld
Any help is greatly appreciated.
Note: I do have root, this is a VPS.
Simple things first, have you added *.domain.tld as a subdomain in cPanel using the user interface and not the command line?
I have tried to replicate this problem using one of my WHM servers and could not.
I recommend first updating cPanel/WHM to the latest version as some support articles covering wildcard subdomains point to some old versions of cPanel have bugs with wildcard subs which are now fixed.
I would also rebuild the httpd.conf if you have at any point manually edited it. Also make sure that the subdomain is not the same as the hostname as this causes some internal binding errors.
I set my environment up using only the cPanel sudomain button and not using the DNS editors in WHM or cPanel
I want to host a root domain like "example.com". The Alias addon allows you to host sub domains like "www.example.com".
But how to host the root domain "example.com" on cloudcontrol? Because I want to create a redirect from example.com to www.example.com.
I have already setup an alias from www.example.com to my cloudControl app successfully. But I was not able to setup an alias from example.com to my cloudControl app.
I'm not sure, whether I have understood everything with the Alias addon.
Best regards,
Christian
Since you can't add a CNAME to a root romain you can't link it directly to cloudControl.
The ugly way would be to manually create A-records to the (currently 3) cloudControl-loadbalancer-IPs, but cloudControl changes these (adds/removes loadbalancers) sometimes so you shouldn't do this.
For my apps I usually use the "URL"-record-type many DNS-Providers provide. In the background they use A-records to a seperate webserver that returns a redirect to the www-version.
You can also use a service like DNS Made Easy. They provide a custom type called ANAME, that's basically a CNAME without the CNAME limitations. They take care of updating the IP addresses in the background when necessary.
http://www.dnsmadeeasy.com/technology/aname-records/
I have purchased My Domain name from one registrar & hosted in another hosting company.
I have created a sub domain from my hosting domain manager lie http://subdomain.domain.com and it works fine. But when someone types in www.subdomain.domain.com the site is not working.
Do I need to make changes in my DNS Manager of hosting CPanel or DNS Manager of my Domain CPanel?
Also What all Records I need to add ( like A Record or CNAME) to redirect www.subdomain.domain.com to subdomain.domain.com.
I don't want to see www for my subdomain, but only wants to get redirected to subdomain.domain.com.
It doesn't work because www.subdomain.domain.com doesn't exist. You have to add a CNAME record in your zone subdomain.domain.com the same way you've added the host subdomain to domain.com.
You need to register that subdomin too.
Yes - www.subdomain.domain.com is a subdomin of subdomain.domain.com. There is nothing special about the www prefix, as far as the domain system or browsers are concerned.
This helped me out. I hope it helps anyone going through the same thing.
Yes, as you said CNAME record www for customer1.mysite.com will report an error.
To make it working, you should be able to add CNAME record www.customer1 for mysite.com instead of www for customer1.mysite.com - xMudrii https://www.digitalocean.com/community/questions/how-to-configure-subdomains-to-use-www-and-non-www
Create CNAME as sub.domain.
Point to # where sub.domain is your subdomain name and maindomain name.
If you want to add "www" in the subdomain then create the same configuration subdomain and add "www" in that domain.
you required to add both domains name www.subdomain.domain.com and subdomain.domain.com
Say you have a website www.example.com and you want to have a working link like www.service.example.com, then you need to enter the subdomain name www.service (and not service) while setting up the sub-domain.
Preferably set up both sub-domains i.e. www.service and service for users who type in www.service.example.com and service.example.com on their browsers.