How to make Azure Traffic Manager work when 301 redirecting custom domains? - redirect

I have a couple of web apps in azure (same codebase, in different regions) that I need to set up as end points in Traffic Manager.
One of those sites is already Live. It is configured to support multiple domains, but all requests are 301 redirected to a specific domain, for SEO reasons. The other site needs to work in the same way of course, within the Traffic Manager setup.
The issue is that Traffic Manager needs to be able to ping the *.azurewebsites.net domain and receive a 200 response to work, but with the current redirect rule in place on the endpoints, this will not work.
If I remove the redirect rule then Traffic Manager will work, but it means that requests for the sites at *.azurewebsites.net will not be redirected (and so presents an SEO concern).
The solution I'm heading towards is serving up a different robots.txt file (with a Disallow: / rule) if the request is for the azurewebsites.net domain. Is this feasible? How might I go about doing this?
Are there any other ways I could make this work?
thanks

I'm going to rework the current redirect rule so that it doesn't redirect for one particular path on the azurewebsites.net domain (*.azurewebsites.net/favicon.ico), which should enable Traffic Manager to ping the site, whilst keeping SEO ok for the rest of the Urls.

7 years later and some months, the answer seems to be in the traffic manager's config under other expected codes, so you can add 301-302 to that list to make your host health show online.

Related

Is it possible to set up an API to serve html from another domain?

I'm curious whether if it's possible to set up a server to respond with html fetched from another domain rather than simply redirect the requester to that domain.
For example, I set up a simple node express server that has a GET route /google, which fetches google.com, and then responds with the response from the fetch. However, in this case, it does not respond with the google webpage as I would expect.
It is not only possible but quite common especially in larger server environments. The term you are looking for is reverse-proxy.
Proxying is typically used to distribute the load among several servers, seamlessly show content from different websites, or pass requests for processing to application servers over protocols other than HTTP.
Source: https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
Most major web servers support it.
More than likely the response you're getting from google (and passing on) is some kind of redirection. Try it with a static web page of your own to rule out any redirection shenanigans.

Can I use Cloudflare to 301 redirect domains without A records?

I am using CloudFlare to manage my websites DNS. I want to use Page Rules to setup redirects for a number of URLs to go to another website URL.
Currently my hosting account, I have set them all up as addon domains and then setup redirects in CPanel.
I am moving across my sites to my own cloud server without a CPanel - I am using VestaCP. I don't want to clutter up the website records by adding each and every site I want to redirect to the host (there is a dozen of them) - I want Cloudflare to manage it all.
Is it possible to do this? Like use Cloudflare page rules and remove the A record pointing to the host server IP?
In order for you to use Page Rule to redirect to another site, there are 2 conditions:
Valid A record or CNAME record
That record is orange-clouded
The A record can point to any public IP address, for example 8.8.8.8, it doesn't matter because the visitor will be redirected away anyway. However it can't be IP address that belongs to Cloudflare (e.g. 1.1.1.1).
Similarly to CNAME record, can be pointed to any domain/subdomain (e.g google.com).
Cloudflare has a KB article that explains how you can configure the Page Rule to do the 301 redirection.

whitelist api endpoint based on host or domain

I'm building an endpoint which returns images. I want to only allow requests from the same domain for this endpoint so that other people won't have access to it. I can't use CORS because you can essentially make the call inside an image tag and bypass any cors restrictions. Is there anyway to do this?
If your goal is to prevent simple hotlinking, you can do a referrer check: Check the Referer [sic!] header, make sure it contains a whitelisted domain.
Keep in mind that the Referer header is sometimes missing, e.g. because it has been removed by security software concerned about the user’s privacy.
Also, it is needless to say that referrer-based checks are easily circumvented by anybody who is determined to abuse your service.
Although you cannot (as far as I know) forge the referrer in a browser request (e.g. to download the image with AJAX), you could simply set up a proxy server which would download the images with a forged referrer header and deliver them to the actual client.
But, at least, it would take some energy to do so, and you could easily block such a server by IP address (unless it's a pool of IP addresses).

If a https domain is redirecting to a http domain. Is there any point in having it?

I looked around the internet to see if there was a clear answer to this, but it looks like there isn't. So, I work for a small company and one of the domains we have, has the SSL certification with it (https://hmc2agency.com); however, it redirects to the new "brand image" (http://www.wearehmc.com). I'm trying to figure out if we should even keep the certification, since it'll be expiring soon.
It's not like we sell things, or need the encryption stream (a term I could be pulling out of no where); however, we do host a few Facebook page tabs (I was told, that they need https domains) on the site. But, they don't use the HTTPS URL for "app."
Ehh I don't know, I just like to code, I'm no network administrator.
There is no difference except for the fact that you have encryption on that Domain.
The DNS servers have knowledge that https://hmc2agency.com has a SSL cert and therefore will do everything in its power to maintain the cert and domain but once you redirected the domain to another domain the cert losses its 'power'.
In this case nothing really happens. Its a simple 302 redirect...you should change this to a 301 redirect for SEO purposes.
This is a good article for how HTTPs works.

SaaS location of admin URL

Background
I work at a SaaS company where you get a site when you signup.
If the company's url is saas.com this could be a list of clients:
abc.saas.com
mysite.saas.com
so.saas.com
Currently, each of our clients has to go to /admin to get to his admin panel.
abc.saas.com/admin
mysite.saas.com/admin
so.saas.com/admin
The thing is that services like Clicktale that track users by recording them, limit the amount of subdomains you can track. If you want more subdomains, you have to pay more.
Because of this we are analyzing the possibility of migrating to admin.saas.com as a single subdomain for all admin panels.
Which are the pros and cons of having several /admin subdomains VS a single admin subdomain?
Considerations 
SSL is already solved, we have a wildcard certificate
We could keep a 301 redirect from /admin to the admin.saas.com
Thanks!
Pros to have a single domain (admin.saas.com):
Users having more subscriptions can manage subdomains much easier (they don't have to navigate to a different URL)
Your documentation and videos will be easier to understand with a specific address. Links with placeholders like {yourdomain}.saas.com/admin make clients think.
Firewall rules could be set up easier in a complex architecture
We had to make the same decision while developing our SaaS/PaaS product few months ago and we are happy with this implementations. According to your scenario, I cannot see any cons.