Announcement

Collapse
No announcement yet.

implementing the X-Forwarded-For header

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Forum] implementing the X-Forwarded-For header

    Since I am using google pagespeed services, ive got problems with vbulletin cache.

    All active members reported me that they cannot login. After entering username and password, they can see redirecting window but after coming again on index page it ask for login again.

    Google developer asked me to implement the x forwarded for header. How can i do that for vbulletin?

  • #2
    You, or they will need to be a bit more specific.

    Comment


    • #3
      Thank you for the reply Zachery, this is my problem and their answer:



      After moving to PageSpeed Service, my users complain that they cannot login to my site or get unexpectedly logged out. How can I fix this?


      The most common cause for this problem is the IP address checks in your reference site that validate the user's IP address and checks that it doesn't change across a session. Since your site is now CNAMEd to Google, the client IP address that is seen by your reference servers is Google's IP address, which may vary across a session. The actual client IP address can now be found in the X-Forwarded-For header. Please use this IP address if your server places any of the above restrictions for login to your site.

      How do I know the client IP address for my users' requests?

      PageSpeed Service serves your webpages and so all requests to your origin server will be from Google's IP addresses. To get the IP address of the user on your origin server, use the value stored in the X-Forwarded-For HTTP header. Here are some tips to correctly configure your host and retrieve the X-Forwarded-For header value in common web hosting software:
      • Apache: The client IP address can be obtained within your configuration file using the %{X-Forwarded-For}i variable. If you don't care about recording PageSpeed server IP addresses, you can simply replace the traditional %h with %{X-Forwarded-For}i in the format string of your server logs.
      • PHP: If your site or application is written in PHP, the real client IP address can be retrieved using the [URL="http://php.net/manual/en/reserved.variables.server.php"]server variable[/URL="http://php.net/manual/en/reserved.variables.server.php"] $_SERVER['HTTP_X_FORWARDED_FOR'].




      which information do you need more Zachery?

      Comment


      • #4
        Assuming you are using VB 4.2.0 (and the config.php file from VB 4.2.0) find this line near the end of the file:

        Code:
        //$config['Misc']['proxyipheader'] = 'HTTP_X_FORWARDED_FOR';
        and remove the two slashes in front (//) - this is called uncommenting the line. Re-save the file and upload it to your server.

        IP addresses will now be taken fro the HTTP_X_FORWARDED_FOR header.

        Comment


        • #5
          This is not working for me.

          Comment


          • #6
            Enter your known Proxy IPs in your config.php and remove the comment slashes from the line.
            Translations provided by Google.

            Wayne Luke
            The Rabid Badger - a vBulletin Cloud demonstration site.
            vBulletin 5 API - Full / Mobile
            Vote for your favorite feature requests and the bugs you want to see fixed.

            Comment


            • #7
              but google pagespeed doesnt use only 1 IP.

              PHP Code:
              /* Enter your known [trusted] proxy servers here. You can list multiple trusted IPs separated by a comma.*/
              $config['Misc']['proxyiplist'] = '172.0.0.1,74.125.';

              /* If the real IP is passed in a http header variable other than HTTP_X_FORWARDED_FOR, then you can set the name here; */
              $config['Misc']['proxyipheader'] = 'HTTP_X_FORWARDED_FOR'
              I have it like this since an hour, and its not working.

              source: https://developers.google.com/speed/...s/faq#clientip
              Last edited by iraqiboy90; Mon 4th Mar '13, 12:10pm.

              Comment


              • #8
                Then you need a list of their ip's it doesn't support partials.

                Comment


                • #9
                  Im have problems to logins, some solution to the list of IPS? if anyone has the complete list of IPS PageSpeed​​, would be helpful.

                  Comment


                  • #10
                    Originally posted by Zachery View Post
                    Then you need a list of their ip's it doesn't support partials.
                    How do we enter that in there? Comma seperated?

                    Comment


                    • #11
                      Yes, comma separated, have to define each ip address right now.

                      Comment


                      • #12
                        Hello, I'm running vbulletin 4.1.11 : there's a similar solution for that version? Thank you
                        Last edited by tintin74; Thu 5th Sep '13, 6:53am.

                        Comment


                        • #13
                          Sorry, but your version doesnt have that option, you will either have to upgrade to a current release or use the better option, install mod_rpaf, using mod_rpaf will not require additional resources by passing the connection thru vb/php.

                          Let apache handle it by using mod_rpaf.

                          Nginx also has real_ip
                          Gentoo Geek

                          Comment

                          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                          Working...
                          X