Title: How does the plugin work with FastCGI cache?
Last modified: June 14, 2023

---

# How does the plugin work with FastCGI cache?

 *  [Artyom](https://wordpress.org/support/users/ryabchuk/)
 * (@ryabchuk)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/how-does-the-plugin-work-with-fastcgi-cache/)
 * The site is installed on a Nginx server. With fastcgi_cache. This server displays
   the cached version regardless of the visitor’s IP. On website installed woocommerce
   too. All  AJAX endpoint options is enabled in plugin settings.
 * I use these functions:
   `geoip_detect2_get_info_from_current_ip()`
 * Please help with the solution.
    -  This topic was modified 2 years, 11 months ago by [Artyom](https://wordpress.org/support/users/ryabchuk/).
    -  This topic was modified 2 years, 11 months ago by [Artyom](https://wordpress.org/support/users/ryabchuk/).
    -  This topic was modified 2 years, 11 months ago by [Artyom](https://wordpress.org/support/users/ryabchuk/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhow-does-the-plugin-work-with-fastcgi-cache%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [Artyom](https://wordpress.org/support/users/ryabchuk/)
 * (@ryabchuk)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/how-does-the-plugin-work-with-fastcgi-cache/#post-16822169)
 * Maybe there is a function similar to `geoip_detect2_get_info_from_current_ip`
   with ajax?
 *  Thread Starter [Artyom](https://wordpress.org/support/users/ryabchuk/)
 * (@ryabchuk)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/how-does-the-plugin-work-with-fastcgi-cache/#post-16822744)
 * I added this script to js file:
 *     ```wp-block-code
       jQuery(document).ready(function($) {
           $.ajax({
             url: '/wp-admin/admin-ajax.php',
             method: 'GET',
             data: {
               action: 'geoip_detect2_get_info_from_current_ip',
             },
             success: function(response) {
               var country = response.country.names.en;
               var isoCode = response.country.iso_code;
   
               console.log('Country: ' + country);
               console.log('ISO Code: ' + isoCode);
   
               // Make an AJAX request to a separate PHP script
               $.ajax({
                 url: '/wp-admin/admin-ajax.php',
                 method: 'POST',
                 data: {
                   url: '/wp-content/themes/bethub/inc/product_layout/side_block.php',
                   country: country,
                   isoCode: isoCode
                 }
               });
             },
             error: function(xhr, status, error) {
               // Handle any errors that occur during the AJAX request
               console.error(error);
             }
           });
         });
       ```
   
 * In `side_block.php` I am calling values:
 *     ```wp-block-code
       $country = $_POST['country'];
       $isoCode = $_POST['isoCode'];
   
       echo 'Values received: ' . $country . ', ' . $isoCode;
       ```
   
 * But values are empty. What am I doing wrong?
    -  This reply was modified 2 years, 11 months ago by [Artyom](https://wordpress.org/support/users/ryabchuk/).
 *  Plugin Author [Benjamin Pick](https://wordpress.org/support/users/benjaminpick/)
 * (@benjaminpick)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/how-does-the-plugin-work-with-fastcgi-cache/#post-16863190)
 * Did you make sure admin-ajax.php is excluded from the fastcgi cache?
 * The jQuery script seems ok (but there is a simplfied JS API if you like: [https://github.com/yellowtree/geoip-detect/wiki/API:-AJAX#frontend-js-helper-functions](https://github.com/yellowtree/geoip-detect/wiki/API:-AJAX#frontend-js-helper-functions)).
   What does the admin-ajax.php call return (see network tab of the DevTools, or
   call manually?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘How does the plugin work with FastCGI cache?’ is closed to new replies.

 * ![](https://ps.w.org/geoip-detect/assets/icon-256x256.jpg?rev=978998)
 * [Geolocation IP Detection](https://wordpress.org/plugins/geoip-detect/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/geoip-detect/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/geoip-detect/)
 * [Active Topics](https://wordpress.org/support/plugin/geoip-detect/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/geoip-detect/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/geoip-detect/reviews/)

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)
 * [fastcgi](https://wordpress.org/support/topic-tag/fastcgi/)
 * [nginx](https://wordpress.org/support/topic-tag/nginx/)

 * 3 replies
 * 2 participants
 * Last reply from: [Benjamin Pick](https://wordpress.org/support/users/benjaminpick/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/how-does-the-plugin-work-with-fastcgi-cache/#post-16863190)
 * Status: not resolved