Why should I use multiple origins for a cloudfront distribution? - amazon-cloudfront

I understand, that I get a new domain for my distribution, but why would i need multiple origins for one distribution?

A scenario could be a single CloudFront distribution for example.com with multiple sub-applications (origins) that come together to create a single application:
Static website at / (S3 configured as static website endpoint)
Blog at /blog path (ALB)
API at /api path (API Gateway)
Static assets at /static path (S3 bucket)

Related

Azure Firewall Routing to multiple backends

We are trying to host multiple sites at the backend of Azure Firewall, however we have about 30 different sites and each with their own test\dev and UAT site, which means 30 x 4 and 120 sites, each one is hosted on port 443, all have their own public IP, and are configured with a DNAT rule for directing the traffic based on the source to the correct backend, we have considered a Azure Application Gateway, with host header redirect, but we haven't had a chance to implement it yet, I was wondering is there a way to be cleverer and use Azure firewall with less public IP's and route to various backends, also the prod public sites have no source specified as they're open to the public.
Hope I've explained that clearly. Thanks
• Yes, what you are trying to achieve is very much possible by creating backend pools of websites according to their purpose, common domain name or the URL path routing. For this purpose, you can use the Azure application gateway efficiently by configuring it with the required features given in it.
First, you can define wildcard hostnames in multiple site listeners for up to 5 hostnames per listener, i.e., suppose you have three domain names under which the multiple various web sites are hosted, then you can create pools of public IP addresses under that respective domain name and ensure that the request for that domain’s website is routed accordingly in application gateway. Similarly, you can host multiple subdomains of the same parent domain on the same application gateway deployment.
For more information on configuring the above, kindly refer to the documentation link below: -
https://learn.microsoft.com/en-us/azure/application-gateway/multiple-site-overview#wildcard-host-names-in-listener
• Also, you can distinguish the requests to each one of the websites with a public IP address by configuring URL based path routing rules for either each one of them or categorizing them into pools of common domain name, common URL path, content to be fetched, common purpose or any such characteristic through which you can make a collection of them. URL Path Based Routing allows you to route traffic to back-end server pools based on URL Paths of the request. One of the scenarios is to route requests for different content types to different backend server pools. Thus, in this way, you can route requests to backend website pools by defining the correct required parametric configurations.
For more information on configuring the above, kindly refer to the documentation link below: -
https://learn.microsoft.com/en-us/azure/application-gateway/url-route-overview\
Also, you can configure request routing rules based on combining the above two features in one. For more information regarding this, kindly refer to the documentation link below which describes in detail when and how you should configure the various path based and listener-based rules in application gateway: -
https://learn.microsoft.com/en-us/azure/application-gateway/configuration-request-routing-rules

Azure CDN Rules to redirect path to different origin

My aim is to host various microsites using Azure Statics App and then have these registered as origins in CDN.
When the user would then browse to https://www.example.com/path1, static app1 (origin1) should serve the content where as https://www.example.com/path2 should be served by static app2 (origin2).
I have tried to use the Rules engine and then setup a condition, if url path begins with /path1* with an action to override the origin group, but this doesn't seem to work.
Any ideas what should be done here?

Azure storage containers and routing from wildcard root domain

I have a storage account in Azure with a container named clients. Inside the container I have folders for various clients, i.e:
mysite.blob.core.windows.net/clients/one
mysite.blob.core.windows.net/clients/two
I also have my own site set up as a static website, i.e:
mysite.z33.web.core.windows.net
On top of that, I have a custom domain: mysite.com. Is it possible, using Azure CDN or Azure Front Door/Application Gateway to route traffic like so (in a way that doesn't require further configuration per client):
one.mysite.com -> mysite.blob.core.windows.net/clients/one
two.mysite.com -> mysite.blob.core.windows.net/clients/two
mysite.com -> mysite.z33.web.core.windows.net
So far I have tried doing this with Azure CDN but I don't think it's possible, it has a rules engine that seems quite flexible but I don't think they support wildcard domains, unless I'm (hopefully) wrong. Ideally I'd like it to be done in some sort of wildcard way, so that is maps:
<client>.mysite.com -> mysite.blob.core.windows.net/clients/<client>
I don't really want to have to add more rules or configuration every time I have a new client.
In fact, you could use an alias record to add a root domain as the custom domains in your CDN endpoints if you use Azure CDN to host your DNS zone. In this case, you need to set up multiple endpoints for each custom domain. See this document for more details. But Pointing a zone apex to CDN endpoints for Azure CDN from Akamai is currently not supported. You can use other CDN price tier.
If you use the Azure application gateway, you may configure multiple sites listener to receive different incoming host traffic and use path-based URL rules to route the traffic to the backends. It looks like a complex configuration and hard to troubleshoot the app gw related issue.
The azure front door should also do this trick, it supports onboard a root domain on your Front Door also allows wildcard domains. The route path is also easy to configure. See path matching for more details.
Hope this information could help you.

How to create multiple origins with Azure CDN Verizon Edgecast Premium?

I come from AWS Cloudfront where I can create multiple origins for a given endpoint.
I can serve part of the url from one origin and part from another origin.
Is there anyway we can do with Azure CDN Verizon Edgecast Premium?
EDIT1: (Cloudfront Example with Single Distribution)
https://example.com/origin1/index.html <-- This is served from origin1
https://example.com/origin2/index.html <-- This is served from origin2
or like this also,
https://example.com/endpoint/index.html <-- comes from origin1
https://example.com/endpoint/index1.html <-- comes from origin2
Here is how I solved it. Looks horrible in the modern era, but it is what it is at the time of this writing.
If you want to have multiple origins. Create one endpoint for each origin.
Endpoint1 --> Origin1
Endpoint2 --> Origin2
Create another endpoint Endpoint to create rewrite rules to those endpoints with a rewrite rule.
Endpoint3/origin1 rewrite to Endpoint1
Endpoint3/origin3 rewrite to Endpoint2
You can create rewrite rules only to other endpoints and not to any origin.
Hope it helps.

Redirection on Elastic Load Balance based routing

I need help in this scenario
My an ec2 instance is receiving requests, I don't want on client end to change server path based on few requests (especially on chat)
My first ec2 instance bypass requests based on few path patterns to my other created instance. (In other words, I want to redirect traffic from first to second)
Is there any way to fulfill above scenario.
You can use AWS CloudFront as a proxy for your use case where you can plugin the two EC2 instances behind CloudFront as Origins and Add behavior rules (Path rules) to switch traffic to one or the other.
Your client will send requests only to the CloudFront URL(Or DNS mapped through Route53) and won't be knowing about the EC2 instances behind. This approach will work, if your EC2 instances are publicly accessible but will be cost effective and reduce the load on your services, if you happen to cache content.
Alternative approach is to use an Application Load Balancer with path based routing configuration.
Following tutorial will guide you through the steps.
Tutorial: Use Path-Based Routing with Your Application Load Balancer

Resources