Pivotal Knowledge Base

Follow

Using Custom Domain Names With Pivotal Web Services

Environment

Pivotal Web Services

Purpose

The following explains how to setup custom Domain Names within your PWS environment. For example if your app name is myapp and your domain is mydomain.com you can access your app by going to http://myapp.mydomain.com or http://www.myapp.mydomain.com rather than myapp.cfapps.io
 

Procedure

You will need to do the following to point your Domain Name at your Application on PWS.
  1. Register your Domain Name with a Domain Registrar.
  2. Point your Domain name at your PWS environment.
  3. Add your Domain to the PWS environment.
  4. Add a route on the PWS environment.
 
 
1. Register your domain name
For example mydomain.com with a Domain Name Registrar of your choice.
 
2. Edit DNS Records: mydomain.com
Login to your Domain Name Providers site and edit your setting as follows.

 
 TypeHostAnswerTTLPrioCreated 
  CNAME *.mydomain.com myapp.cfapps.io 300 N/A 2016-01-01  
 
 
The above will forward all http/https traffic for *.mydomain.com to your site on PWS myapp.cfapps.io
 
 
URL Forwarding: mydomain.com
 
Note you will get an error if you hit myapp.cfapps.io at this point. So you will need to setup a forward so that myapp.cfapps.io gets forwarded to www.myapp.cfapps.io
 
On your Domain Name Providers site, setup a URL Redirect as follows. 
 
Forward all traffic
From: http://*.mydomain.com
To: http://www.mydomain.com
 
 
3. Add your Domain to the PWS environment
 
cf create-domain
$cf create-domain myorg mydomain.com 
 
$cf domains
 
Getting domains in org myorg as 

name            status  
cfapps.io       shared  
mydomain.com   owned  

 
4. Map a route to your application using cf map-route 
 
$cf map-route myapp mydomain.com -n myapp
$cf map-route myapp mydomain.com -n www
 
cf routes
Getting routes as myemail@mydomain.com ...

space         host       domain          apps  

development   myapp   mydomain.com   myapp   

development   www        mydomain.com   myapp
 
 
 
You should now be able to access your Application hosted on Pivotal Web Services using your Domain name.
 
 
 
Checking DNS has been configured correctly.
 
You can check the routing is working correctly using the Dig command.
 

$dig mydomain.com

 

; <<>> DiG 9.8.3-P1 <<>> mydomain.com

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9924

;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

 

;; QUESTION SECTION:

;mydomain.com. IN A

 

;; ANSWER SECTION:

mydomain.com. 300 IN A 75.126.100.8

 

;; Query time: 2198 msec

;; SERVER: 168.159.216.74#53(168.159.216.74)

;; WHEN: Tue Nov 17 10:43:53 2015

 

;; MSG SIZE  rcvd: 47

 

 

$dig www.mydomain.com

; <<>> DiG 9.8.3-P1 <<>> www.mydomain.com

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36851

;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

 

;; QUESTION SECTION:

;www.mydomain.com. IN A

 

;; ANSWER SECTION:

www.mydomain.com. 300 IN CNAME myapp.cfapps.io.

myapp.cfapps.io. 60 IN A 54.172.222.102

myapp.cfapps.io. 60 IN A 54.88.215.24

 

;; Query time: 194 msec

;; SERVER: 128.221.224.144#53(128.221.224.144)

;; WHEN: Tue Nov 17 10:46:24 2015

;; MSG SIZE  rcvd: 99

; <<>> DiG 9.8.3-P1 <<>> myapp.mydomain.com

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60641

;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

 

;; QUESTION SECTION:

;myapp.mydomain.com. IN A

 

;; ANSWER SECTION:

myapp.mydomain.com. 300 IN CNAME myapp.cfapps.io.

myapp.cfapps.io. 60 IN A 54.88.215.24

myapp.cfapps.io. 60 IN A 54.172.222.102

 

Comments

Powered by Zendesk