• Hello Team,

    I’m having an unusual issue with the FlyingPress plugin (https://flyingpress.com/). For some reason, the mobile version of the site is displaying the desktop version instead. We’ve configured the settings to create a separate cache for mobile, including the query string scfm-mobile, but it doesn’t seem to be working as expected.

    Interestingly, when I clear the cache, everything displays correctly, but after a few refreshes, the desktop version appears on mobile again. Could this be a compatibility issue?

    I am also using Cloudflare Enterprise, which includes cache preloading. Any ideas or suggestions on what might be causing this would be greatly appreciated.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Bufi SysAdm

    (@bufisys)

    Seems it is issue with FlyingPress plugin, their team is working to resolve it.

    Plugin Author Jose

    (@giuse)

    Hi @bufisys

    thank you for reporting this issue. Let me know if they have any questions about the plugin.
    Have a great day!

    Jose

    Thread Starter Bufi SysAdm

    (@bufisys)

    Hi Jose,

    It seems that FlyingPress and FlyingCDN are not compatible with this plugin, due that FlyingCDN doesn’t generate a separate cache for mobile devices. I resolved this by adding to header below Javascript. Hope it help someone else who uses same.

    <script type="text/javascript">
    // Run the redirection check as soon as possible
    (function() {
    // Simple mobile detection
    var isMobile = window.innerWidth <= 768 || /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);

    if (isMobile) {
    // Check if 'scfm-mobile=1' is already in the URL
    if (window.location.href.indexOf('scfm-mobile=1') === -1) {
    // Append '?scfm-mobile=1' to the current URL
    var newUrl = window.location.href + (window.location.href.indexOf('?') === -1 ? '?' : '&') + 'scfm-mobile=1';

    // Redirect before loading other resources
    window.location.replace(newUrl);
    }
    }
    })();
    </script>

    All needed to be done afterwards is to ensure that they cache that query string.

    Plugin Author Jose

    (@giuse)

    Hi @bufisys

    thank you for the information and for your solution.

    Theoretically, you don’t need that script. You should find this in your .htaccess file:

    # BEGIN Specific Content For Mobile
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi [NC]
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} !scfm-mobile
    RewriteCond %{QUERY_STRING} !wc-ajax
    RewriteCond %{QUERY_STRING} !^$
    RewriteCond %{REQUEST_URI} !\.
    RewriteRule ^(.*)$ %{REQUEST_SCHEME}://%{HTTP_HOST}%{REQUEST_URI}\?%{QUERY_STRING}\&scfm-mobile=1 [L,NS,R=301]
    RewriteCond %{HTTP_USER_AGENT} Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi [NC]
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} !scfm-mobile
    RewriteCond %{QUERY_STRING} !wc-ajax
    RewriteCond %{QUERY_STRING} ^$
    RewriteCond %{REQUEST_URI} !\.
    RewriteRule ^(.*)$ %{REQUEST_SCHEME}://%{HTTP_HOST}%{REQUEST_URI}\?scfm-mobile=1 [L,NS,R=301]
    </IfModule>
    # END Specific Content For Mobile

    The code above is added by SCFM to add exactly the query string you are adding via JavaScript.

    If the redirect is done from the .htaccess file, it will consume practically zero. On the contrary, if you do it via JavaScript, PHP + MySql have to run before building the page, then the page is sent to the browser, and only when the browser parses your script you have the redirect. This is bad for performance.

    You should check your .htaccess file, and if you don’t find the code described above, we should try to understand why you don’t have it.
    If you don’t find that code, I suggest you:

    • Be sure you have the latest version of Specific Content For Mobile
    • Disable and enable again (without removing it because you would lose the settings) Specific Content For Mobile
    • Visit the backend page Settings => Permalinks
    • Check again the file .htaccess
    • Delete the browser cache
    • Delete the FlyingPress and FlyingCDN cache

    Please, let me know if you can see that code in your .htaccess file.

    Have a great day!

    Jose

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