Skip to content
This repository has been archived by the owner on Nov 13, 2018. It is now read-only.

add Geolimit failure redirect feature (short for NGB) #1067

Merged
merged 3 commits into from
Mar 15, 2016

Conversation

nbaoping
Copy link
Contributor

In the past, if the Geolimit check fails (for example, the client ip is not in the 'US' region but the geolimit is set to 'CZ + US'), the router will return 503 response; but with this feature, when the check fails, it will return 302 if the redirect url is set in the delivery service.

The Geolimit check failure has such scenarios:

  1. When the geolimt is set to 'CZ + only', if the client ip is not the the CZ file, the check fails
  2. When the geolimit is set to any region, like 'CZ + US', if the client ip is not in such region, the check fails

And different configured redirect urls have different meanings:

  1. If no domain is in the url (like 'vod/dance.mp4'), the router will try to find a proper cache server and return the redirect url with the format like 'http://<cache server name>.<delivery service's FQDN>/<configured relative path>'
  2. If has domain, it has two different scenarios:
    1. If the domain matches with the delivery service, the router will also try to find a proper cache server and return the same format url as point 1.
    2. If the domain doesn't match with the delivery service, the router will return the configured url directly to the client.
  3. If no url is set, this feature will be disabled for this delivery service

@nbaoping
Copy link
Contributor Author

Will there be anyone to check my pull request? @dneuman64


if (idx < 0) {
//this is a relative url, belongs to this ds
type = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting type to 0 or 1 doesn't have an easy to understand meaning. Can you use names to describe the two modes? For example maybe "Relative URL" and "Absolute URL"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for comment. It makes sense, I will set it to string type.

@dneuman64
Copy link
Member

yes, we will be looking into it soon. I am sorry we havent yet. As of right now it has conflicts, can you clean those up?

@nbaoping
Copy link
Contributor Author

nbaoping commented Mar 1, 2016

ok, I will fix the new conflicts and update it soon!

@nbaoping nbaoping force-pushed the ngb-master branch 3 times, most recently from 473c53c to b003cbf Compare March 3, 2016 08:10
@nbaoping
Copy link
Contributor Author

nbaoping commented Mar 3, 2016

I updated the code, will check it again? @dneuman64 @limited

@dneuman64
Copy link
Member

yes, will do today @nbaoping

@dneuman64
Copy link
Member

any way you could add a test or two that exercises the intended behavoir?

final Iterator<String> itr = dsMap.keySet().iterator();
while (itr.hasNext()) {
final DeliveryService ds = dsMap.get(itr.next());
String type = "INVALID_URL";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be better to just not set this here and do ds.setGeoRedirectUrlType() for each case instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I will add some tests for it

@nbaoping
Copy link
Contributor Author

nbaoping commented Mar 9, 2016

Some code was refactored, and more UTs were added, would you check it again? @dneuman64 @limited

@dneuman64
Copy link
Member

Thanks, I will take a look at it either today or tomorrow. One more ask: when you get a chance can you add some documentation explaining what it is and how to configure it? Something similiar to what you have in the PR description would be great. This page might be a good place for it: http://traffic-control-cdn.net/docs/latest/admin/traffic_router.html

@dneuman64
Copy link
Member

Hey @nbaoping this all looks good. I will merge once you add some docs. Thanks!

@nbaoping
Copy link
Contributor Author

Sorry for late, sure, I will add the doc

@nbaoping
Copy link
Contributor Author

Hi @dneuman64 , the doc was added, please have a look, thanks!


Overview
--------
This feature is also called 'National GeoBlock' feature which is short for NGB feature. In this section, the 'NGB' will used for this feature.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the 'NGB' will used for" -> "the acronym 'NGB' will be used for"

@dneuman64
Copy link
Member

Thanks for reviewing that @limited!

@dneuman64 dneuman64 added this to the 1.5.0 milestone Mar 14, 2016
@dneuman64 dneuman64 self-assigned this Mar 14, 2016
@nbaoping
Copy link
Contributor Author

@limited thanks for your detail reviewing, I updated it, please have a look, thanks!

dneuman64 pushed a commit that referenced this pull request Mar 15, 2016
add Geolimit failure redirect feature (short for NGB)
@dneuman64 dneuman64 merged commit 8f34a58 into Comcast:master Mar 15, 2016
@mtorluemke mtorluemke modified the milestones: 1.6.0, 1.5.0 Jun 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants