Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

[solved] Detected Different Country

[solved] Detected Different Country

Hi,

I created rules to do redirection for user from Malaysia only. However, Chameleon detected my location as US instead of Malaysia when I enabled the Debuggind mode. If I Google "What's my IP address", the Google detected me from MY. Do you have any idea where could be the problem is?

Thanks in advance! smile

hafism
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

Re: [solved] Detected Different Country

Hi,

I think it might be that your web server is reporting the IP address of the server (in the US?) rather than the client. Can you please tell me which exact version of Chameleon you are using? There were some changes in recent versions of Chameleon that were supposed to help this but you might have an older one, or the changes may not be working on your setup.

Also can you try the following in the PHP box in a Chameleon rule, then copy and paste the output into the forum?

echo "<pre>";
print_r($_SERVER);
echo "</pre>";

Usually the server variable will contain the client IP address as well as server address and any proxies in the system.

Thanks,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: [solved] Detected Different Country

Hi,

Thanks for the prompt reply smile

I'm using Chameleon 2.49 on Joomla 3.4.8

I also have put the PHP script, and here is the output.

Message
CHAMELEON DEBUG ON
CHAMELEON DEBUG ON
URL must have changed. Was: http://demo1[dot]averis[dot]biz/asianagri_ver17/templates/asianagri/img/desc-arrow.png/, Now: http://demo1[dot]averis[dot]biz/asianagri_ver17/id/our-business-id/bisnis-kami/perkebunan
Current date and time: "2016-03-15 11:21:06am" in timezone "Asia/Kuala_Lumpur"
Processing rule id 8 ("Rule 1: detect the URL")
- GeoIP: enabled
- GeoIP Country id: US
- GeoIP Country name: United States
- GeoIP: Country "US" is not in the include list
Started FAIL action for rule id 8
Finished FAIL action: default template style not changed
Processing rule id 9 ("Rule 2: detect session variable")
- Session Variable not found
Started FAIL action for rule id 9
Finished FAIL action: default template style not changed
Processing rule id 10 ("Rule 3: redirect")
- GeoIP: enabled
- GeoIP Country id: US
- GeoIP Country name: United States
- GeoIP: Country "US" is not in the include list
Started FAIL action for rule id 10
Finished FAIL action: default template style not changed
Finished all rules
Final template style unchanged

It still detected US id. Not sure whether this is because of my rule is wrong or what. Again, here is what I want to do:

User in MY: when they open http://demo1[dot]averis[dot]biz/asianagri_ver17, they will redirect to http://demo1[dot]averis[dot]biz/asianagri_ver17/id

User from the rest of the world: when they open http://demo1[dot]averis[dot]biz/asianagri_ver17, they will redirect to http://demo1[dot]averis[dot]biz/asianagri_ver17/en

hafism
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

Re: [solved] Detected Different Country

Hi,

Thanks for the output - it's clear that the system is detecting a US IP address, and I strongly suspect that it's a server setup issue that is causing this, and preventing Chameleon from detecting the *client* IP address.

Can you try the following in the PHP box in a Chameleon rule, then copy and paste the output into the forum?

echo "<pre>";
print_r($_SERVER);
echo "</pre>";

You might need to temporarily disable the existing Chameleon rules so that this one runs.

From the output of this we should be able to see if the server is placing the client IP address into an unusual server variable. If that's the case then I can build a work-around into Chameleon so that it detects the correct IP address.

Thanks,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: [solved] Detected Different Country

Hi,

I have unpublished current rules, created a new one with this config:

Enable GeoIP Country
Quick Rules: Only these countries: MY
PHP:
echo "<pre>";
print_r($_SERVER);
echo "</pre>";


And here is the output...

Message

CHAMELEON DEBUG ON
CHAMELEON DEBUG ON
URL must have changed. Was: http://demo1[dot]averis[dot]biz/asianagri_ver17/, Now: http://demo1[dot]averis[dot]biz/asianagri_ver17/en/
Current date and time: "2016-03-15 11:41:32am" in timezone "Asia/Kuala_Lumpur"
Processing rule id 12 ("Test PHP rule")
- GeoIP: enabled
- GeoIP Country id: US
- GeoIP Country name: United States
- GeoIP: Country "US" is not in the include list
Started FAIL action for rule id 12
Finished FAIL action: default template style not changed
Finished all rules
Final template style unchanged



Please help me bro sad

hafism
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

Re: [solved] Detected Different Country

Hi metamodguy,

Any update on the work-around?

Thanks smile

hafism
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

Re: [solved] Detected Different Country

Hi bro,

Here is the output from the PHP code. (I changed the URL to mysite.com and hide my IP)




    [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    [PROCESSOR_ARCHITECTURE] => x86
    [PROCESSOR_IDENTIFIER] => Intel64 Family 6 Model 62 Stepping 4, GenuineIntel
    [PROCESSOR_LEVEL] => 6
    [PROCESSOR_REVISION] => 3e04
    [ProgramData] => C:\ProgramData
    [ProgramFiles] => C:\Program Files (x86)
    [ProgramFiles(x86)] => C:\Program Files (x86)
    [ProgramW6432] => C:\Program Files
    [PSModulePath] =>
    [PUBLIC] => C:\Users\Public
    [SystemDrive] => C:
    [SystemRoot] => C:\Windows
    [TEMP] => C:\Windows\TEMP
    [TMP] => C:\Windows\TEMP
    [USERDOMAIN] =>
    [USERNAME] =>
    [USERPROFILE] =>
    [windir] => C:\Windows
    [windows_tracing_flags] => 3
    [windows_tracing_logfile] =>
    [ORIG_PATH_INFO] => /PATH/index.php
    [URL] => /PATH/index.php
    [SERVER_SOFTWARE] => Microsoft-IIS/7.5
    [SERVER_PROTOCOL] => HTTP/1.1
    [SERVER_PORT_SECURE] => 0
    [SERVER_PORT] => 80
    [SERVER_NAME] => mysite.com
    [SCRIPT_NAME] => /PATH/index.php
    [SCRIPT_FILENAME] => PATH\index.php
    [REQUEST_URI] => /PATH/id/
    [REQUEST_METHOD] => GET
    [REMOTE_USER] =>
    [REMOTE_PORT] => 23804
    [REMOTE_HOST] => 10.0.0.232
    [REMOTE_ADDR] => 54.240.148.45
    [QUERY_STRING] =>
    [PATH_TRANSLATED] => PATH\index.php
    [LOGON_USER] =>
    [LOCAL_ADDR] => 10.0.0.225
    [INSTANCE_META_PATH] => /LM/W3SVC/2
    [INSTANCE_NAME] => DEMO1
    [INSTANCE_ID] => 2
    [HTTPS_SERVER_SUBJECT] =>
    [HTTPS_SERVER_ISSUER] =>
    [HTTPS_SECRETKEYSIZE] =>
    [HTTPS_KEYSIZE] =>
    [HTTPS] => off
    [GATEWAY_INTERFACE] => CGI/1.1
    [DOCUMENT_ROOT] => D:\LiveSites\demo1
    [CONTENT_TYPE] =>
    [CONTENT_LENGTH] => 0
    [CERT_SUBJECT] =>
    [CERT_SERIALNUMBER] =>
    [CERT_ISSUER] =>
    [CERT_FLAGS] =>
    [CERT_COOKIE] =>
    [AUTH_USER] =>
    [AUTH_PASSWORD] =>
    [AUTH_TYPE] =>
    [APPL_PHYSICAL_PATH] =>
    [APPL_MD_PATH] => /LM/W3SVC/2/ROOT
    [IIS_UrlRewriteModule] => 7.1.0761.0
    [UNENCODED_URL] => /PATH/id/
    [IIS_WasUrlRewritten] => 1
    [HTTP_X_ORIGINAL_URL] => /PATH/id/
    [HTTP_X_FORWARDED_PROTO] => http
    [HTTP_X_FORWARDED_PORT] => 80
    [HTTP_X_FORWARDED_FOR] => xxx.xx.xx.xx, 54.240.148.45
    [HTTP_X_AMZ_CF_ID] => obFh37ZLnogpJ1jJq38cYHTWLj5Bs5-HQWqvYDnmxP7o-NOwJ14bwg==
    [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
    [HTTP_REFERER] => mysite.com
    [HTTP_HOST] => mysite.com
    [HTTP_COOKIE] =>
    [HTTP_ACCEPT_ENCODING] => gzip
    [HTTP_CONTENT_LENGTH] => 0
    [HTTP_VIA] => proxy A, 1.1 28410778a359bf53441078c1af5b64ee.cloudfront.net (CloudFront)
    [HTTP_CONNECTION] => keep-alive
    [FCGI_ROLE] => RESPONDER
    [PHP_SELF] => /PATH/index.php
    [REQUEST_TIME_FLOAT] => 1458527009.2876
    [REQUEST_TIME] => 1458527009
    [ADMINTOOLS_REMOTE_ADDR] => 10.0.0.232


If you see [HTTP_X_FORWARDED_FOR] => xxx.xx.xx.xx, 54.240.148.45, the xxx.xx.xx.xx is my IP and 54.240.148.45 is IP from Amazon (from MaxMind). For your info, I host my website in Amazon Web Service.

hafism
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

Re: [solved] Detected Different Country

Hi hafism

thanks so much for this info. I have been able to identify the issue now. Please stand by for an updated version of Chameleon which will fix this issue for you.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3312 Posts
User info in posts
Administrator has disabled public posting

Re: [solved] Detected Different Country

Thanks a lot bro! You are the best! big_smile

Please let me know once it's released smile

hafism
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

Re: [solved] Detected Different Country

Thanks for sending me the new version of Chameleon. I have tried that and it work like a charm! Now the plugin detected correct location based on IP address! Thanks! big_smile

hafism
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Total Posts Today:
1
User Info:
 
Total Users:
10075
Newest User:
rsker57
Members Online:
0
Guests Online:
258

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked