[Skip to main content](#vessel-content)

#   Real IP Address of Client and SSL status

##

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 3 months ago [\#22287](#22287) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  *[Real IP Address of Client and SSL status](/forum/2-general-talk-about-hikashop/22287-real-ip-address-of-client-and-ssl-status#22287 "Had an interesting encounter with a server sitting behind a hardware load balancer - the app sees all traffic as http and the client IP address it sees is the address of the load balancer!  Looking at the Hikashop code there are various checks of the form $&#95;SERVER.  From my investigations so far it looks like a more robust check for SSL is something like this (the HTTP&#95;X&#95;FORWARDED&#95;PROTO value might need to be enabled by the server administrator):  Similarly for the client IP address need to code something like this:  Is it possible to modify Hikashop code to cater for this situation or do you have other suggestions as to how this type of setup might be handled? - seems too complicated a setup for my liking, although I can see the logic of simplifying the upgrade process if your site traffic outgrows your environment.  Looking at core Joomla 1.6 code it also does a simple $&#95;SERVER check.  See:")* was created by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")*

Had an interesting encounter with a server sitting behind a hardware load balancer - the app sees all traffic as http and the client IP address it sees is the address of the load balancer!

Looking at the Hikashop code there are various checks of the form *$\_SERVER*.

From my investigations so far it looks like a more robust check for SSL is something like this (the HTTP_X_FORWARDED_PROTO value might need to be enabled by the server administrator): Code:

if ( (isset($_SERVER['HTTPS']) &amp;&amp; !empty($_SERVER['HTTPS']) &amp;&amp; (strtolower($_SERVER['HTTPS']) != 'off')) &#124;&#124; (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &amp;&amp; $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ) { ... handle SSL case ... } else { ... handle non-SSL case ... }

Similarly for the client IP address need to code something like this: Code:

&gt; function GetUserIP() { if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) $client_ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; else if (isset($_SERVER["HTTP_CLIENT_IP"])) $client_ip = $_SERVER["HTTP_CLIENT_IP"]; else $client_ip = $_SERVER["REMOTE_ADDR"];

Is it possible to modify Hikashop code to cater for this situation or do you have other suggestions as to how this type of setup might be handled? - seems too complicated a setup for my liking, although I can see the logic of simplifying the upgrade process if your site traffic outgrows your environment.

Looking at core Joomla 1.6 code it also does a simple $_SERVER check.

See:
[ Dire load balancing straits](http://devcentral.f5.com/weblogs/macvittie/archive/2010/06/03/dire-load-balancing-straits-want-my-client-ip.aspx)
[ Joomla proxy patch](http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=20285)
[ Getting real IP of your users](http://thepcspy.com/read/getting_the_real_ip_of_your_users/)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzIyMjg3LXJlYWwtaXAtYWRkcmVzcy1vZi1jbGllbnQtYW5kLXNzbC1zdGF0dXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

15 years 3 months ago [\#22290](#22290) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Real IP Address of Client and SSL status](/forum/2-general-talk-about-hikashop/22287-real-ip-address-of-client-and-ssl-status#22290 "Had an interesting encounter with a server sitting behind a hardware load balancer - the app sees all traffic as http and the client IP address it sees is the address of the load balancer!  Looking at the Hikashop code there are various checks of the form $&#95;SERVER.  From my investigations so far it looks like a more robust check for SSL is something like this (the HTTP&#95;X&#95;FORWARDED&#95;PROTO value might need to be enabled by the server administrator):  Similarly for the client IP address need to code something like this:  Is it possible to modify Hikashop code to cater for this situation or do you have other suggestions as to how this type of setup might be handled? - seems too complicated a setup for my liking, although I can see the logic of simplifying the upgrade process if your site traffic outgrows your environment.  Looking at core Joomla 1.6 code it also does a simple $&#95;SERVER check.  See:")*

We'll include that improvement about the HTTP_X_FORWARDED_PROTO variable in next release. For the IP address, we already handle it that way, so there is nothing to do.
Even without that improvement, it should still work. We have code in place in order to avoid redirect loops to https when https is not detected and that the https redirect is activated in hikashop.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzIyMjg3LXJlYWwtaXAtYWRkcmVzcy1vZi1jbGllbnQtYW5kLXNzbC1zdGF0dXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

15 years 3 months ago [\#22291](#22291) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Re: Real IP Address of Client and SSL status](/forum/2-general-talk-about-hikashop/22287-real-ip-address-of-client-and-ssl-status#22291 "Had an interesting encounter with a server sitting behind a hardware load balancer - the app sees all traffic as http and the client IP address it sees is the address of the load balancer!  Looking at the Hikashop code there are various checks of the form $&#95;SERVER.  From my investigations so far it looks like a more robust check for SSL is something like this (the HTTP&#95;X&#95;FORWARDED&#95;PROTO value might need to be enabled by the server administrator):  Similarly for the client IP address need to code something like this:  Is it possible to modify Hikashop code to cater for this situation or do you have other suggestions as to how this type of setup might be handled? - seems too complicated a setup for my liking, although I can see the logic of simplifying the upgrade process if your site traffic outgrows your environment.  Looking at core Joomla 1.6 code it also does a simple $&#95;SERVER check.  See:")*

Thanks.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzIyMjg3LXJlYWwtaXAtYWRkcmVzcy1vZi1jbGllbnQtYW5kLXNzbC1zdGF0dXM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.080 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
