JuChom
JuChom

Reputation: 5989

Create subdomains in staging azure web role

I have a solution with two projects: - Project1 is an asp.net mvc 4 project - Project2 is an asp.net webapi project

I want to have both of them on the same webrole, in production it seems that I can do the following:

In staging the base url is something like ec3abfacbfb27a1800f6bc0f2b168121.cloudapp.net, is there a way to do this:

Thanks in advance

Upvotes: 1

Views: 407

Answers (2)

Edward Brey
Edward Brey

Reputation: 41648

First, set up the routing within your web app, if you haven't already. It should look for the api prefix on the host name, but otherwise be independent the URL.

Then for manual testing with a browser, edit %SystemRoot%\System32\drivers\etc\hosts and add a line for api.abcdefghijklmnopqrstuvwxyz.cloudapp.net, using your staging server's IP address.

For automated testing, have the test client connect to the staging server using its regular host name (without the api prefix) but set the Host header to include the api prefix as desired.

Upvotes: 0

astaykov
astaykov

Reputation: 30903

No. And in your particular scenario (as well as many more) I would suggest to not use staging environment at all. Use another production environment instead. And name it [myapp-stating].cloudapp.net for example.

Than create a mapping with your own custom domain (say it is myapp.com):

  • staging.web.myapp.com -> CNAME -> myapp-staging.cloudapp.net
  • staging.api.myapp.com -> CNAME -> myapp-staging.cloudapp.net

Upvotes: 2

Related Questions