Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
When we are trying test personalisation group package on cloud front, we are getting below issue:
Exception occured:MaxMind.GeoIP2.Exceptions.GeoIP2Exception: The specified IP address was incorrectly formatted: 18.104.22.168, 22.214.171.124 at Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding, CacheItemPriority priority, CacheItemRemovedCallback removedCallback, CacheDependency dependency) at Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, Func1 getCacheItem)
at Zone.UmbracoPersonalisationGroups.Providers.GeoLocation.MaxMindGeoLocationProvider.GetCountryFromIp(String ip)
at Zone.UmbracoPersonalisationGroups.Criteria.Country.CountryPersonalisationGroupCriteria.MatchesVisitor(String definition)
at Zone.UmbracoPersonalisationGroups.PersonalisationGroupMatcher.IsMatch(PersonalisationGroupDefinitionDetail definitionDetail)
at Zone.UmbracoPersonalisationGroups.PersonalisationGroupMatcher.CountMatchingDefinitionDetails(PersonalisationGroupDefinition definition)
at Umbraco.Web.PublishedContentExtensions.ShowToVisitor(IList1 pickedGroups, Boolean showIfNoGroupsDefined)
Umbraco Version: 7.3
Personalisation Package version: 0.2.5
It looks like there's a problem extracting the requesting IP address, I guess because it's going through CloudFront. Or rather it is getting the IP address, but seems to be actually getting two - 126.96.36.199, 188.8.131.52 and as I'm treating that as a single one we get this error as it's not an expected format.
I've implemented this here for reference.
Are you able to dig out what headers come over with IP based information from Cloudfront? If so I may be able to determine a better header to use. If not, can set up something to check if for some reason we do get two or more comma delimited IPs, to just take the first one.
We are getting "X-Forwarded-For" header with IP based information from cloudfront.
Please look into below link for more info: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html
Thanks for the update. OK, have learnt something here. I thought X-Forwarded-For would only ever contain a single IP but seems that's not always the case.
From here: "the value is a comma+space separated list of IP addresses, the left-most being the original client, and each successive proxy that passed the request adding the IP address where it received the request from."
So looks like I need to account for that, and if there's more than one IP, take the first one to get the IP from where the request is coming from.
I'll get a new release together with this behaviour in so you can upgrade.
Could you do me a favour please and check if you swap in the dll for this one is resolves the issue for you?
If so, I'll prepare an update to the package.
Thanks for your help.
Provided dll has resolved the issue for me.
Great, good to hear and thanks for checking it.
I've pushed out a new release to NuGet and our - version 0.3.3 - so if you prefer you can reference that now.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted