Reputation: 1826
Motivation: We're maintaining a website hosted on premises https://customerRelationsSite.com
This website will soon be gone, We would like to create a URL redirect to other sites with the following use cases
redirect https://customerRelationsSite.com/eula/prodmanager?app=myapp to domain.salesforce.com/eula/prod/myapp
or redirect https://customerRelationsSite.com/eula/prodmanager?app=myapp to domain.salesforce.com/eula/prod/myapp
meanwhile more links will be created that will gradually replace the current site links i.e. https://customerRelationsSite.com/otherPaths, which will be redirected to other sites https://othersite/newPath so the solution should be configurable to add new redirects
We're looking at the following options:
or
or
location ~ ^/path/(?<section>.*) {
resolver 8.8.8.8;
proxy_pass https://othersite/newPath/$section$is$
}
location ~ ^/eula/prodmanager/(?<section>.*) {
resolver 8.8.8.8;
proxy_pass https://domain.salesforce.com/eula/prod/myapp/$section$is$
}
Which options would you consider? or are there other optimal options available out there?
Upvotes: 0
Views: 1441
Reputation: 3602
You can do this with a static S3 bucket:
https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html
As you say, simply point (through whatever DNS means you prefer) the domain to an otherwise empty S3 bucket, and setup the redirect(s) as documented above.
For a bonus point, you can have a custom 404 page etc installed too:
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<ReplaceKeyWith>404.html</ReplaceKeyWith>
</Redirect>
</RoutingRule>
</RoutingRules>
This avoids any complexity of hosting haproxy
instances or Linux instances generally - and is cost effective and recommended by AWS themselves.
(On an aside note - the 404 trick works great with Single Page Apps hosted statically in S3 buckets. Redirect all 404 URLs back to index.html
- and let the SPA do the rest!)
Upvotes: 1