Join the community today
Register Now

Beta Branch update centmin.sh menu 22 cache enabler setup in 123.09beta01

Discussion in 'Centmin Mod Github Commits' started by eva2000, Sep 9, 2020.

  1. eva2000

    eva2000 Administrator Staff Member

    54,920
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:41 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    update centmin.sh menu 22 cache enabler setup in 123.09beta01

    - At query string inclusion for ?ref so /usr/local/nginx/conf/wpcacheenabler_map.conf include file now looks like below. Existing users will need to manually update the map include file to below and then run commands for wp-cli to update the regex query string include


    Code (Text):
    cd /home/nginx/domain/yourdomain.com/public
    \wp option patch update cache-enabler incl_parameters '/^fbclid|ref|mc_(cid|eid)|utm_(source|medium|campaign|term|content|expid)|gclid|fb_(action_ids|action_types|source)|age-verified|ao_noptimize|usqp|cn-reloaded|_ga|_ke$/' --allow-root
    

    the updated /usr/local/nginx/conf/wpcacheenabler_map.conf include file contents
    Code (Text):
    map $http_user_agent $cmwpcache_device {
        default                                     'desktop';
        ~*(iPad|iPhone|Android|IEMobile|Blackberry) 'mobile';
        "~*Firefox.*Mobile"                         'mobile';
        "~*ipod.*mobile"                            'mobile';
        "~*Opera\ Mini"                             'mobile';
        "~*Opera\ Mobile"                           'mobile';
        "~*Mobile"                                  'mobile';
        "~*Tablet"                                  'mobile';
        "~*Kindle"                                  'mobile';
        "~*Windows\ Phone"                          'mobile';
    }
    
    map $args $q_ignorearg {
      default               0;
      "~*fbclid"            1;
      "~*gclid"             1;
      "~*utm"               1;
      "~*fb_action_ids"     1;
      "~*fb_action_types"   1;
      "~*fb_source"         1;
      "~*age-verified"      1;
      "~*ao_noptimize"      1;
      "~*usqp"              1;
      "~*cn-reloaded"       1;
      "~*_ga"               1;
      "~*_ke"               1;
      "~*mc_cid"            1;
      "~*mc_eid"            1;
      "~*ref"               1;
    }
    


    Continue reading...

    123.09beta01 branch
     
  2. rdan

    rdan Well-Known Member

    5,447
    1,408
    113
    May 25, 2014
    Ratings:
    +2,201
    Local Time:
    6:41 PM
    Mainline
    10.2
    I used this method to strip query strings on non WP site so I only use this on every vhost:
    Code:
    if ($q_ignorearg) {
    rewrite ^ $uri? permanent;
        }
    
    Problem is all URL with query string gets redirected.
    Not just those string listed on nginx map.

    What could be the problem?
    Thanks.

    Only happens on URL with /(slash) at the end.
     
    Last edited: Sep 11, 2020
  3. eva2000

    eva2000 Administrator Staff Member

    54,920
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:41 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Strange what does map contents look like ? That's old way but with Cache Enabler you should use the updated method which preserves the query string but still caches the url
    Code (Text):
        # include query strings fbclid, gclid, utm in cache via stripping them with
        # 302 redirect via mapping in /usr/local/nginx/conf/wpcacheenabler_map.conf
        if ($q_ignorearg) {
          set $check_qurl $request_uri;
          set $check_surl $request_uri;
          set $cache_uri $uri;
        }
        add_header Check-Querystring-Uri "$check_qurl";
        #add_header Q-Ignore-Arg "$q_ignorearg";
    

    Code (Text):
    curl -s "http://msdomain.com/?fbclid" 2>&1 | tail -2
    <!-- Cache Enabler by KeyCDN @ 11.09.2020 14:15:46 (http html) -->
    

    Code (Text):
    curl -I "http://msdomain.com/?fbclid"
    HTTP/1.1 200 OK
    Date: Fri, 11 Sep 2020 14:48:32 GMT
    Content-Type: text/html; charset=utf-8
    Content-Length: 12253
    Last-Modified: Fri, 11 Sep 2020 14:15:46 GMT
    Connection: keep-alive
    Vary: Accept-Encoding
    ETag: "5f5b8692-2fdd"
    Server: nginx centminmod
    X-Powered-By: centminmod
    X-Xss-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    Check-Querystring-Uri: /?fbclid
    Accept-Ranges: bytes
     
  4. rdan

    rdan Well-Known Member

    5,447
    1,408
    113
    May 25, 2014
    Ratings:
    +2,201
    Local Time:
    6:41 PM
    Mainline
    10.2
    Exactly on the first post.

    I use it on NON WP site, xenforo site for example.
     
  5. eva2000

    eva2000 Administrator Staff Member

    54,920
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:41 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    In that case not sure why all query strings are getting redirected, if the map is correct it should work provided fastcgi_cache is configured properly.
     
  6. rdan

    rdan Well-Known Member

    5,447
    1,408
    113
    May 25, 2014
    Ratings:
    +2,201
    Local Time:
    6:41 PM
    Mainline
    10.2
    Why does it relate to fastcgi_cache?
     
  7. eva2000

    eva2000 Administrator Staff Member

    54,920
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    8:41 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    fastcgi_cache is still a nginx server level configuration even if it's related to PHP-FPM. So what I mean is your nginx/fastcgi_cache configuration.
     
  8. rdan

    rdan Well-Known Member

    5,447
    1,408
    113
    May 25, 2014
    Ratings:
    +2,201
    Local Time:
    6:41 PM
    Mainline
    10.2
    Some valid URL that gets redirected:
    /css.php?css=public%3Anotices.less%2Cpublic%3Aprefix_menu.less%2Cpublic%3Ashare_controls.less%2Cpublic%3Astructured_list.less%2Cpublic%3Aextra.less&s=3&l=1&d=1600015234&k=xxxxxxxxxxxxxxxxxxx
     
  9. rdan

    rdan Well-Known Member

    5,447
    1,408
    113
    May 25, 2014
    Ratings:
    +2,201
    Local Time:
    6:41 PM
    Mainline
    10.2
    I'd say not related to fastcgi_cache as it happens for logged user also.
     
  10. rdan

    rdan Well-Known Member

    5,447
    1,408
    113
    May 25, 2014
    Ratings:
    +2,201
    Local Time:
    6:41 PM
    Mainline
    10.2
    What I did for now is to remove the ARG that is prune to false redirect or too short keyword:
    And change utm to have underscore: