Magento Nginx: cache first page request only (no session) for super speedMagento speed & cacheMagento Admin Nginx 404Full Page Cache for constantly updated pages?Full page cache causes checkout POST request to fail, only when logged in!Nginx 502 Error only with full page cache enabled or trying to go to the adminCache Control for magento & Nginx advicemagento enterprise session cache issue500 Internal Server Error nginx/1.12.0 on checkout page after Migration from Apache to NginxNew install on EC2 rewrite issues

Meme-controlled people

How do I change two letters closest to a string and one letter immediately after a string using Notepad++?

Is it good practice to use Linear Least-Squares with SMA?

Tikz picture of two mathematical functions

Most cost effective thermostat setting: consistent temperature vs. lowest temperature possible

Knife as defense against stray dogs

Why Choose Less Effective Armour Types?

Why do tuner card drivers fail to build after kernel update to 4.4.0-143-generic?

The German vowel “a” changes to the English “i”

What exactly is this small puffer fish doing and how did it manage to accomplish such a feat?

How do you talk to someone whose loved one is dying?

Why do newer 737s use two different styles of split winglets?

Is there a hypothetical scenario that would make Earth uninhabitable for humans, but not for (the majority of) other animals?

Print a physical multiplication table

How could an airship be repaired midflight?

How difficult is it to simply disable/disengage the MCAS on Boeing 737 Max 8 & 9 Aircraft?

Counting models satisfying a boolean formula

Aluminum electrolytic or ceramic capacitors for linear regulator input and output?

Why does overlay work only on the first tcolorbox?

Brexit - No Deal Rejection

Did Ender ever learn that he killed Stilson and/or Bonzo?

Why is a white electrical wire connected to 2 black wires?

Does this sum go infinity?

What is a ^ b and (a & b) << 1?



Magento Nginx: cache first page request only (no session) for super speed


Magento speed & cacheMagento Admin Nginx 404Full Page Cache for constantly updated pages?Full page cache causes checkout POST request to fail, only when logged in!Nginx 502 Error only with full page cache enabled or trying to go to the adminCache Control for magento & Nginx advicemagento enterprise session cache issue500 Internal Server Error nginx/1.12.0 on checkout page after Migration from Apache to NginxNew install on EC2 rewrite issues













0















In an effort (and test) to make Magento fly I was playing with microcaching in Magento and came up with the following.



The idea is to: detect a first visit and return visit. A return visit may already have an item in the cart or some session params so we need the dynamic full (slow) Magento. But for first time (never before) visitors we could serve a cached almost static ready to send version?



Question: can we distinguish complete new vs. return visitors in Nginx? And how would we then serve a static file to the complete new visitors (frontpage + categories + cms + products)



General conf



fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=MAGENTO:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;


Server block



 # CACHE TEST
set $skip_cache 0;

# CACHE TEST
if ($http_cookie ~* "frontend_cid|frontend|sid|adminhtml")
set $skip_cache 1;


# CACHE TEST
if ($request_method = POST)
set $skip_cache 1;


# CACHE TEST
if ($query_string != "")
set $skip_cache 1;



## Execute PHP scripts
location ~ .php$
include /etc/nginx/conf.d/headers.conf;
add_header Strict-Transport-Security "max-age=31556926; includeSubDomains; preload";
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE $storecode;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;

# CACHE TEST
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;

fastcgi_cache MAGENTO;
fastcgi_cache_valid 60m;










share|improve this question














bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • hm, varnish is much better for this.

    – MagenX
    Apr 15 '17 at 9:55















0















In an effort (and test) to make Magento fly I was playing with microcaching in Magento and came up with the following.



The idea is to: detect a first visit and return visit. A return visit may already have an item in the cart or some session params so we need the dynamic full (slow) Magento. But for first time (never before) visitors we could serve a cached almost static ready to send version?



Question: can we distinguish complete new vs. return visitors in Nginx? And how would we then serve a static file to the complete new visitors (frontpage + categories + cms + products)



General conf



fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=MAGENTO:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;


Server block



 # CACHE TEST
set $skip_cache 0;

# CACHE TEST
if ($http_cookie ~* "frontend_cid|frontend|sid|adminhtml")
set $skip_cache 1;


# CACHE TEST
if ($request_method = POST)
set $skip_cache 1;


# CACHE TEST
if ($query_string != "")
set $skip_cache 1;



## Execute PHP scripts
location ~ .php$
include /etc/nginx/conf.d/headers.conf;
add_header Strict-Transport-Security "max-age=31556926; includeSubDomains; preload";
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE $storecode;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;

# CACHE TEST
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;

fastcgi_cache MAGENTO;
fastcgi_cache_valid 60m;










share|improve this question














bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • hm, varnish is much better for this.

    – MagenX
    Apr 15 '17 at 9:55













0












0








0








In an effort (and test) to make Magento fly I was playing with microcaching in Magento and came up with the following.



The idea is to: detect a first visit and return visit. A return visit may already have an item in the cart or some session params so we need the dynamic full (slow) Magento. But for first time (never before) visitors we could serve a cached almost static ready to send version?



Question: can we distinguish complete new vs. return visitors in Nginx? And how would we then serve a static file to the complete new visitors (frontpage + categories + cms + products)



General conf



fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=MAGENTO:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;


Server block



 # CACHE TEST
set $skip_cache 0;

# CACHE TEST
if ($http_cookie ~* "frontend_cid|frontend|sid|adminhtml")
set $skip_cache 1;


# CACHE TEST
if ($request_method = POST)
set $skip_cache 1;


# CACHE TEST
if ($query_string != "")
set $skip_cache 1;



## Execute PHP scripts
location ~ .php$
include /etc/nginx/conf.d/headers.conf;
add_header Strict-Transport-Security "max-age=31556926; includeSubDomains; preload";
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE $storecode;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;

# CACHE TEST
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;

fastcgi_cache MAGENTO;
fastcgi_cache_valid 60m;










share|improve this question














In an effort (and test) to make Magento fly I was playing with microcaching in Magento and came up with the following.



The idea is to: detect a first visit and return visit. A return visit may already have an item in the cart or some session params so we need the dynamic full (slow) Magento. But for first time (never before) visitors we could serve a cached almost static ready to send version?



Question: can we distinguish complete new vs. return visitors in Nginx? And how would we then serve a static file to the complete new visitors (frontpage + categories + cms + products)



General conf



fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=MAGENTO:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;


Server block



 # CACHE TEST
set $skip_cache 0;

# CACHE TEST
if ($http_cookie ~* "frontend_cid|frontend|sid|adminhtml")
set $skip_cache 1;


# CACHE TEST
if ($request_method = POST)
set $skip_cache 1;


# CACHE TEST
if ($query_string != "")
set $skip_cache 1;



## Execute PHP scripts
location ~ .php$
include /etc/nginx/conf.d/headers.conf;
add_header Strict-Transport-Security "max-age=31556926; includeSubDomains; preload";
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE $storecode;
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params;

# CACHE TEST
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;

fastcgi_cache MAGENTO;
fastcgi_cache_valid 60m;







cache full-page-cache nginx server-setup






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 11 '17 at 20:17









snh_nlsnh_nl

2,9031046105




2,9031046105





bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 7 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • hm, varnish is much better for this.

    – MagenX
    Apr 15 '17 at 9:55

















  • hm, varnish is much better for this.

    – MagenX
    Apr 15 '17 at 9:55
















hm, varnish is much better for this.

– MagenX
Apr 15 '17 at 9:55





hm, varnish is much better for this.

– MagenX
Apr 15 '17 at 9:55










1 Answer
1






active

oldest

votes


















0














Unfortunately, the answer is "you can't".



Magento 1.x will always set the frontend cookie, and outside application level (Nginx, Varnish, etc.) you can't know whether it is a new visit or not.






share|improve this answer






















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f154326%2fmagento-nginx-cache-first-page-request-only-no-session-for-super-speed%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Unfortunately, the answer is "you can't".



    Magento 1.x will always set the frontend cookie, and outside application level (Nginx, Varnish, etc.) you can't know whether it is a new visit or not.






    share|improve this answer



























      0














      Unfortunately, the answer is "you can't".



      Magento 1.x will always set the frontend cookie, and outside application level (Nginx, Varnish, etc.) you can't know whether it is a new visit or not.






      share|improve this answer

























        0












        0








        0







        Unfortunately, the answer is "you can't".



        Magento 1.x will always set the frontend cookie, and outside application level (Nginx, Varnish, etc.) you can't know whether it is a new visit or not.






        share|improve this answer













        Unfortunately, the answer is "you can't".



        Magento 1.x will always set the frontend cookie, and outside application level (Nginx, Varnish, etc.) you can't know whether it is a new visit or not.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 8 '17 at 19:56









        Danila VershininDanila Vershinin

        41227




        41227



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f154326%2fmagento-nginx-cache-first-page-request-only-no-session-for-super-speed%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Disable / Remove link to Product Items in Cart Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How can I limit products that can be bought / added to cart?Remove item from cartHide “Add to Cart” button if specific products are already in cart“Prettifying” the custom options in cart pageCreate link in cart sidebar to view all added items After limit reachedLink products together in checkout/cartHow to Get product from cart and add it againHide action-edit on cart page if simple productRemoving Cart items - ObserverRemove wishlist items when added to cart

            Helsingin valtaus Sisällysluettelo Taustaa | Yleistä sotatoimista | Osapuolet | Taistelut Helsingin ympäristössä | Punaisten antautumissuunnitelma | Taistelujen kulku Helsingissä | Valtauksen jälkeen | Tappiot | Muistaminen | Kirjallisuutta | Lähteet | Aiheesta muualla | NavigointivalikkoTeoksen verkkoversioTeoksen verkkoversioGoogle BooksSisällissota Helsingissä päättyi tasan 95 vuotta sittenSaksalaisten ylivoima jyräsi punaisen HelsinginSuomalaiset kuvaavat sotien jälkiä kaupungeissa – katso kuvat ja tarinat tutuilta kulmiltaHelsingin valtaus 90 vuotta sittenSaksalaiset valtasivat HelsinginHyökkäys HelsinkiinHelsingin valtaus 12.–13.4. 1918Saksalaiset käyttivät ihmiskilpiä Helsingin valtauksessa 1918Teoksen verkkoversioTeoksen verkkoversioSaksalaiset hyökkäävät Etelä-SuomeenTaistelut LeppävaarassaSotilaat ja taistelutLeppävaara 1918 huhtikuussa. KapinatarinaHelsingin taistelut 1918Saksalaisten voitonparaati HelsingissäHelsingin valtausta juhlittiinSaksalaisten Helsinki vuonna 1918Helsingin taistelussa kaatuneet valkokaartilaisetHelsinkiin haudatut taisteluissa kaatuneet punaiset12.4.1918 Helsingin valtauksessa saksalaiset apujoukot vapauttavat kaupunginVapaussodan muistomerkkejä Helsingissä ja pääkaupunkiseudullaCrescendo / Vuoden 1918 Kansalaissodan uhrien muistomerkkim

            Adjektiivitarina Tarinan tekeminen | Esimerkki: ennen | Esimerkki: jälkeen | Navigointivalikko