Skip to:
Content
Pages
Categories
Search
Top
Bottom

There is a problem when loading activities of the member page on CDN.

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

  • instaup
    Participant

    @instaup

    It sounds like your CDN might be caching the Ajax responses, leading to incorrect member activities on subsequent loads. You can try adjusting the cache settings for Ajax requests in CloudFront or configuring Buddypress to prevent caching of dynamic content. This tweak could help you “instaup” your site’s performance and ensure the correct data is always displayed.


    john201502
    Participant

    @john201502

    –You can try adjusting the cache settings for Ajax requests in CloudFront or configuring Buddypress to prevent caching of dynamic content.
    Thank you for your reply.could you please tell me how to configuring Buddypress to prevent caching of dynamic content?
    Thank you very much.


    john201502
    Participant

    @john201502

    I used this snippet but it doesn’t work.
    https://d6476bsmtk1fy.cloudfront.net/members/dontwait99/

    function disable_cache_for_buddypress() {
    if ( function_exists(‘bp_is_current_component’) &&
    (bp_is_current_component(‘activity’) || bp_is_current_component(‘members’)) ) {
    nocache_headers();
    }
    }
    add_action( ‘wp’, ‘disable_cache_for_buddypress’ );

    function add_nocache_to_ajax_requests() {
    ?>
    <script type=”text/javascript”>
    jQuery(document).ready(function($) {
    $.ajaxSetup({
    beforeSend: function(jqXHR, settings) {
    if (settings.url.indexOf(‘?’) > -1) {
    settings.url += ‘&nocache=’ + new Date().getTime();
    } else {
    settings.url += ‘?nocache=’ + new Date().getTime();
    }
    }
    });
    });
    </script>
    <?php
    }
    add_action( ‘wp_footer’, ‘add_nocache_to_ajax_requests’ );


    ashtonagar
    Participant

    @ashtonagar

    The information you provided suggests a caching issue with your CDN setup for the member page activities. Here are some technical suggestions to investigate and potentially fix the problem:

    1. Caching Configuration on CDN:

    Check your CDN provider’s (CloudFront in this case) caching settings. You likely need to configure it to not cache dynamic content like member activities. Look for options related to “Cache Control” or “Object Caching”. You might need to set a short cache expiry time or disable caching for specific paths (e.g., /members/*).
    2. Caching Headers:

    Ensure your server sends appropriate caching headers with the member activity data. The server should send headers like Cache-Control: no-cache, no-store, must-revalidate to prevent browsers and the CDN from caching this data.
    3. Browser Caching:

    Although less likely, there’s a chance the browser is caching the initial response. Try clearing the browser cache and cookies after the first load to see if the issue persists.
    4. Anti-Proxy Buddypress Plugin:

    While Youzify mentioned the anti-proxy Buddypress plugin, it’s difficult to say definitively if it’s causing the issue without more information. It’s possible the plugin is interfering with the caching mechanism. You can try temporarily disabling the plugin to see if the problem resolves. Be cautious as disabling plugins can have unintended consequences.
    5. Debugging Tools:

    Use browser developer tools (Network tab) to inspect the network requests when loading activities. Look for any caching headers being sent and received. Additionally, check the status code of the requests – a 304 (Not Modified) might indicate the CDN is serving cached data.


    john201502
    Participant

    @john201502

    Hi, thanks for your reply.
    I use Fastest Cache plugin, and I have previously excluded cache for the following specific paths.

    Contains: /members/
    /(.*)/members/(.*)

    I also used the following code in nginx’s conf:

    # /members/ specific rule
    if ($request_uri ~* “^/members/”) {
    add_header Cache-Control “no-cache, no-store, must-revalidate”;
    add_header Pragma “no-cache”;
    add_header Expires “0”;
    }

    But it didn’t help.

    Youzify didn’t mention the anti-proxy Buddypress plugin. They thought that I might not handle Ajax requests properly when using nginx anti-proxy, but they were not sure. They just confirmed that it was a problem with Buddypress, not Youzify. After I disabled Youzify, the problem still exists.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar