Redirect & mask URL to Azure subdomain - asp.net

I have an ASP.NET MVC web app running on Azure as generic-site.co. It's a white-label site that supports a number of subdomains: acme.generic-site.co, globex.generic-site.co, initech.generic-site.co, etc. Browsing to each of them changes branding on the pages, but the underlying functionality is exactly the same.
Meanwhile I have an external domain name acme-site.com hosted by GoDaddy. I want to redirect this specifically to the acme.generic-site.co subdomain, but I also want to maintain acme-site.com as the root URL for any further browsing on that site, allowing users to have a pure acme experience without any indication of the underlying generic-site-ness.
I've tried to do this using GoDaddy's Domain Forwarding with masking, but I ran into CSRF issues almost immediately.
Is there any way I can achieve this? I suspect IIS URL rewriting might be helpful, but I'm at a loss as to how to proceed.

Don't use Domain Forwarding with masking.
Just add custom domain acme-site.com to Azure Web App.
And you may need to do one of the following:
Add a middleware or something that change Host in HTTP request header from
acme.generic-site.co to acme-site.com.
Adjust the application to
load correct branding when using domain acme-site.com.

It is probably easier to use IIS Url Rewrite module as you mentioned in your question. There are several examples on how to do this. Please start with this post by Scott Forsyth: https://weblogs.asp.net/owscott/iis-url-rewrite-redirect-multiple-domain-names-to-one

Related

Different domain names pointing to subfolders in Azure

Not sure if what I'm describing is possible, but if so I'd like to know how.
I have an ASP.NET Azure Shared mode website with a domain, lets say mydomain.com pointing to it. I have a shop there, which is currently at mydomain.com/shop.
What I'd like is to point a different domain, myshop.com to the page at mydomain.com/shop. Can I do that?
Probably the quickest approach would be URL-Rewriting, which is installed by default on Azure Website / WebRole.
Configuration can be made in the web.config -> more details although you I would imagine if you're using MVC there might a slightly more elegant Routing method, maybe?
I'm not sure if I get your question right, but
you could use the HttpResponse Redirect from the .net framework in order to redirect the response.

Web.config redirect outside traffic for testing purposes

This is a bit of a tricky question.
I am developing a .net website, and it is hosted on our own servers.
I want to redirect outside traffic to a blank "coming soon" page, while our internal network can see the content.
How do I modify the web.config to do that?
I have already tried default document settings, but it doesn't seem to accept those, and instead displays the .NET website.
Please have a look at http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module. It shows how to use IIS URL Rewrite Module (which in turns writes to web.config) to handle your scenario.

How can I get two SSL certs to work on a two domain, shared IP configuration

I have two web site that are 99% similar. They share all of the same pages except the difference being that the logos change, a few of the links change, and the products that show up on either web site are flagged to show up on either or, or both. They use the same database.
I have written a utility method that essentially injects a where clause into any database access code I write throughout the app to determine which products to display depending on the current URL.
Problem: Website B gives the user a warning message that the site they are trying to go to is in fact Website A. I've read that the SSL cert needs a distinct IP.
Right now how I have everything set up is very clean on a maintenance perspective. I can update files in one place. Any suggestions on how to make the SSL behave, or am I looking at seperate IP's for the hosting(I really don't want to have to do this)?
If the latter, what do you suggest?
Site runs ASP.NET 4.0. Precompiled DLL.
UPDATE: Thanks to #GregS comment
If the sites share the same domain you can use a wildcard certificate
site1 - site1.somedomain.com
site2 - site2.somedomain.com
Otherwise you will need to get a UCC (United communications certificate) that will be for both domains.
You will need to configure IIS 7 from the command line because the GUI doesn't support setting different host headers for the same certificate. This tutorial shows how it can be done.
I setup another website in IIS that points to the same files as the first web site, got another SSL cert for the new site.

How does one eliminate the "www." at the beginning of urls at the server?

Poorly worded title, but what I want is to do essentially what StackOverflow does when someone types in www.stackoverflow.com: it redirects immediately to stackoverflow.com, eliminating the www. entirely.
Imo, this is the more modern way of doing things: the www. is redundant and (soon to be) archaic. It also breaks an important principle that I want to follow on my web application: that each unique and valid page be accessible by a single url only.
I realize this is a server thing, so I'm expecting the answer to be that the web host needs to take care of this. Since I don't run my own servers, my question is thus: is this possible to do on shared hosting or does one need to be running a dedicated server in order to configure IIS to do this?
The IIS URL Rewriter will allow you to easily set up a canonoical domain rule so all requests are either redirected to www or non www based on your choice. More info on how
Also, several .net shared hosting providers have this module installed so that you can configure this option like you could on your own iis server.
www. is not redundant or archaic if you are using other subdomains. There are issues with cookies that you have to deal with if you set stackoverflow.com as the root domain.
That being said, you would probably want to do something like my answer to a previous question here:
remove 'WWW' in ASP.NET MVC 1.0
Based on the similarities to this question, and based on your tags, I'm voting to close as a duplicate.
Most hosting providers give this for free. The trick itself is usually performed on the DNS level, by introducing a no-hostname A record in your domain.
And this principle of yours is unattainable in principle. At the very least, there's always the URL with IP address instead of name. Then, your server will, most likely, have a private name like server1334.hostingprovider.com, which is also accessible to the world.

Remote hosted flex app

I have a flex app that is hosted on my server. It runs off an amfphp + mysql stack.
I have had inquiries from potential clients who want to "white label" the product. Part of this means that they would want it to appear that the app is running off their server. So their clients would login at www.theirsite.com instead of www.mysite.com.
I obviously dont want to give them the actual app...but are there ways of letting their server redirect to mine without the user actually knowing?
I don't have extensive experience with Flex, but I've worked a lot with Flash. Several ideas come to mind:
Create a wrapper: a SWF that loads your app. With the proper security settings, it should work. Check out this article on crossdomain.xml and the specs for Security.allowDomain()
You could simply embed the SWF from your site, similar to a YouTube video
If that is not satisfactory and your hosting services allow it, you can create a DNS A record or a DNS C record for a subdomain in there site, but you would support all the traffic that page has.
Probably the easiest way would be for them to alter their DNS record to make a CNAME entry (alias) that is a subdomain of theirsite.com:
yourapp.theirsite.com => www.mysite.com

Resources