Is this a varnish hit?












0















I am having an issue with Varnish installed with Magento 2, I have followed this tutorial https://slack-redir.net/link?url=https%3A%2F%2Fwww.techrepublic.com%2Farticle%2Fhow-to-speed-up-apache-with-varnish-http-cache%2F



I used the next command :



curl -I localhost/folder1/folder2
HTTP/1.1 200 OK
Date: Tue, 16 Oct 2018 22:23:50 GMT
Server: Apache/2.4.18 (Ubuntu)
Last-Modified: Fri, 16 Jun 2017 15:47:07 GMT
Vary: Accept-Encoding
Content-Type: text/html
X-Varnish: 131250
Age: 0
Via: 1.1 varnish-v4
ETag: W/"2c39-55215b29954a5-gzip"
Accept-Ranges: bytes
Connection: keep-alive


I normally see in examples that it should have a HIT but I cannot see it, maybes it is badly configured, also when I click a link on my site it will take 6s, then I click on same link and same amount of time so this means it might not be working



My files:



File /etc/varnish/default.vcl



#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.

# Marker to tell the VCL compiler that this VCL has been adapted to the
# new 4.0 format.
vcl 4.0;

# Default backend definition. Set this to point to your content server.
backend default {
.host = "127.0.0.1";
.port = "8080";
}

sub vcl_recv {
# Happens before we check if we have this in cache already.
#
# Typically you clean up the request here, removing cookies you don't need,
# rewriting the request, etc.
}

sub vcl_backend_response {
# Happens after we have read the response headers from the backend.
#
# Here you clean the response headers, removing silly Set-Cookie headers
# and other mistakes your backend does.
}

sub vcl_deliver {
# Happens when we have all the pieces we need, and are about to send the
# response to the client.
#
# You can do accounting or modifying the final object here.
}


File 000-default.conf:



etc/apache2/sites-available/000-default.conf
<VirtualHost *:8080>
blablablabl
</VirtualHost>

/etc/default/varnish
DAEMON_OPTS="-a :80
-T localhost:6082
-f /etc/varnish/default.vcl
-S /etc/varnish/secret
-s malloc,256m"
VARNISH_LISTEN_PORT=80


File /lib/systemd/system/varnish.service



[Unit]
Description=Varnish HTTP accelerator
Documentation=https://www.varnish-cache.org/docs/4.1/ man:varnishd

[Service]
Type=simple
LimitNOFILE=131072
LimitMEMLOCK=82000
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
ExecReload=/usr/share/varnish/reload-vcl
ProtectSystem=full
ProtectHome=true
PrivateTmp=true
PrivateDevices=true

[Install]
WantedBy=multi-user.target


porst.conf file



/etc/apache2/ports.conf
Listen 8080
#blablabla









share|improve this question



























    0















    I am having an issue with Varnish installed with Magento 2, I have followed this tutorial https://slack-redir.net/link?url=https%3A%2F%2Fwww.techrepublic.com%2Farticle%2Fhow-to-speed-up-apache-with-varnish-http-cache%2F



    I used the next command :



    curl -I localhost/folder1/folder2
    HTTP/1.1 200 OK
    Date: Tue, 16 Oct 2018 22:23:50 GMT
    Server: Apache/2.4.18 (Ubuntu)
    Last-Modified: Fri, 16 Jun 2017 15:47:07 GMT
    Vary: Accept-Encoding
    Content-Type: text/html
    X-Varnish: 131250
    Age: 0
    Via: 1.1 varnish-v4
    ETag: W/"2c39-55215b29954a5-gzip"
    Accept-Ranges: bytes
    Connection: keep-alive


    I normally see in examples that it should have a HIT but I cannot see it, maybes it is badly configured, also when I click a link on my site it will take 6s, then I click on same link and same amount of time so this means it might not be working



    My files:



    File /etc/varnish/default.vcl



    #
    # This is an example VCL file for Varnish.
    #
    # It does not do anything by default, delegating control to the
    # builtin VCL. The builtin VCL is called when there is no explicit
    # return statement.
    #
    # See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
    # and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.

    # Marker to tell the VCL compiler that this VCL has been adapted to the
    # new 4.0 format.
    vcl 4.0;

    # Default backend definition. Set this to point to your content server.
    backend default {
    .host = "127.0.0.1";
    .port = "8080";
    }

    sub vcl_recv {
    # Happens before we check if we have this in cache already.
    #
    # Typically you clean up the request here, removing cookies you don't need,
    # rewriting the request, etc.
    }

    sub vcl_backend_response {
    # Happens after we have read the response headers from the backend.
    #
    # Here you clean the response headers, removing silly Set-Cookie headers
    # and other mistakes your backend does.
    }

    sub vcl_deliver {
    # Happens when we have all the pieces we need, and are about to send the
    # response to the client.
    #
    # You can do accounting or modifying the final object here.
    }


    File 000-default.conf:



    etc/apache2/sites-available/000-default.conf
    <VirtualHost *:8080>
    blablablabl
    </VirtualHost>

    /etc/default/varnish
    DAEMON_OPTS="-a :80
    -T localhost:6082
    -f /etc/varnish/default.vcl
    -S /etc/varnish/secret
    -s malloc,256m"
    VARNISH_LISTEN_PORT=80


    File /lib/systemd/system/varnish.service



    [Unit]
    Description=Varnish HTTP accelerator
    Documentation=https://www.varnish-cache.org/docs/4.1/ man:varnishd

    [Service]
    Type=simple
    LimitNOFILE=131072
    LimitMEMLOCK=82000
    ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
    ExecReload=/usr/share/varnish/reload-vcl
    ProtectSystem=full
    ProtectHome=true
    PrivateTmp=true
    PrivateDevices=true

    [Install]
    WantedBy=multi-user.target


    porst.conf file



    /etc/apache2/ports.conf
    Listen 8080
    #blablabla









    share|improve this question

























      0












      0








      0








      I am having an issue with Varnish installed with Magento 2, I have followed this tutorial https://slack-redir.net/link?url=https%3A%2F%2Fwww.techrepublic.com%2Farticle%2Fhow-to-speed-up-apache-with-varnish-http-cache%2F



      I used the next command :



      curl -I localhost/folder1/folder2
      HTTP/1.1 200 OK
      Date: Tue, 16 Oct 2018 22:23:50 GMT
      Server: Apache/2.4.18 (Ubuntu)
      Last-Modified: Fri, 16 Jun 2017 15:47:07 GMT
      Vary: Accept-Encoding
      Content-Type: text/html
      X-Varnish: 131250
      Age: 0
      Via: 1.1 varnish-v4
      ETag: W/"2c39-55215b29954a5-gzip"
      Accept-Ranges: bytes
      Connection: keep-alive


      I normally see in examples that it should have a HIT but I cannot see it, maybes it is badly configured, also when I click a link on my site it will take 6s, then I click on same link and same amount of time so this means it might not be working



      My files:



      File /etc/varnish/default.vcl



      #
      # This is an example VCL file for Varnish.
      #
      # It does not do anything by default, delegating control to the
      # builtin VCL. The builtin VCL is called when there is no explicit
      # return statement.
      #
      # See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
      # and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.

      # Marker to tell the VCL compiler that this VCL has been adapted to the
      # new 4.0 format.
      vcl 4.0;

      # Default backend definition. Set this to point to your content server.
      backend default {
      .host = "127.0.0.1";
      .port = "8080";
      }

      sub vcl_recv {
      # Happens before we check if we have this in cache already.
      #
      # Typically you clean up the request here, removing cookies you don't need,
      # rewriting the request, etc.
      }

      sub vcl_backend_response {
      # Happens after we have read the response headers from the backend.
      #
      # Here you clean the response headers, removing silly Set-Cookie headers
      # and other mistakes your backend does.
      }

      sub vcl_deliver {
      # Happens when we have all the pieces we need, and are about to send the
      # response to the client.
      #
      # You can do accounting or modifying the final object here.
      }


      File 000-default.conf:



      etc/apache2/sites-available/000-default.conf
      <VirtualHost *:8080>
      blablablabl
      </VirtualHost>

      /etc/default/varnish
      DAEMON_OPTS="-a :80
      -T localhost:6082
      -f /etc/varnish/default.vcl
      -S /etc/varnish/secret
      -s malloc,256m"
      VARNISH_LISTEN_PORT=80


      File /lib/systemd/system/varnish.service



      [Unit]
      Description=Varnish HTTP accelerator
      Documentation=https://www.varnish-cache.org/docs/4.1/ man:varnishd

      [Service]
      Type=simple
      LimitNOFILE=131072
      LimitMEMLOCK=82000
      ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
      ExecReload=/usr/share/varnish/reload-vcl
      ProtectSystem=full
      ProtectHome=true
      PrivateTmp=true
      PrivateDevices=true

      [Install]
      WantedBy=multi-user.target


      porst.conf file



      /etc/apache2/ports.conf
      Listen 8080
      #blablabla









      share|improve this question














      I am having an issue with Varnish installed with Magento 2, I have followed this tutorial https://slack-redir.net/link?url=https%3A%2F%2Fwww.techrepublic.com%2Farticle%2Fhow-to-speed-up-apache-with-varnish-http-cache%2F



      I used the next command :



      curl -I localhost/folder1/folder2
      HTTP/1.1 200 OK
      Date: Tue, 16 Oct 2018 22:23:50 GMT
      Server: Apache/2.4.18 (Ubuntu)
      Last-Modified: Fri, 16 Jun 2017 15:47:07 GMT
      Vary: Accept-Encoding
      Content-Type: text/html
      X-Varnish: 131250
      Age: 0
      Via: 1.1 varnish-v4
      ETag: W/"2c39-55215b29954a5-gzip"
      Accept-Ranges: bytes
      Connection: keep-alive


      I normally see in examples that it should have a HIT but I cannot see it, maybes it is badly configured, also when I click a link on my site it will take 6s, then I click on same link and same amount of time so this means it might not be working



      My files:



      File /etc/varnish/default.vcl



      #
      # This is an example VCL file for Varnish.
      #
      # It does not do anything by default, delegating control to the
      # builtin VCL. The builtin VCL is called when there is no explicit
      # return statement.
      #
      # See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
      # and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.

      # Marker to tell the VCL compiler that this VCL has been adapted to the
      # new 4.0 format.
      vcl 4.0;

      # Default backend definition. Set this to point to your content server.
      backend default {
      .host = "127.0.0.1";
      .port = "8080";
      }

      sub vcl_recv {
      # Happens before we check if we have this in cache already.
      #
      # Typically you clean up the request here, removing cookies you don't need,
      # rewriting the request, etc.
      }

      sub vcl_backend_response {
      # Happens after we have read the response headers from the backend.
      #
      # Here you clean the response headers, removing silly Set-Cookie headers
      # and other mistakes your backend does.
      }

      sub vcl_deliver {
      # Happens when we have all the pieces we need, and are about to send the
      # response to the client.
      #
      # You can do accounting or modifying the final object here.
      }


      File 000-default.conf:



      etc/apache2/sites-available/000-default.conf
      <VirtualHost *:8080>
      blablablabl
      </VirtualHost>

      /etc/default/varnish
      DAEMON_OPTS="-a :80
      -T localhost:6082
      -f /etc/varnish/default.vcl
      -S /etc/varnish/secret
      -s malloc,256m"
      VARNISH_LISTEN_PORT=80


      File /lib/systemd/system/varnish.service



      [Unit]
      Description=Varnish HTTP accelerator
      Documentation=https://www.varnish-cache.org/docs/4.1/ man:varnishd

      [Service]
      Type=simple
      LimitNOFILE=131072
      LimitMEMLOCK=82000
      ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
      ExecReload=/usr/share/varnish/reload-vcl
      ProtectSystem=full
      ProtectHome=true
      PrivateTmp=true
      PrivateDevices=true

      [Install]
      WantedBy=multi-user.target


      porst.conf file



      /etc/apache2/ports.conf
      Listen 8080
      #blablabla






      magento2 varnish varnish-vcl






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 16 '18 at 22:32









      dreiddreid

      216




      216
























          2 Answers
          2






          active

          oldest

          votes


















          0














          It is not a cache hit.



          You can see if cache was hit by checking value of X-Varnish: 131250. Single number is a cache miss, two numbers, e.g. X-Varnish: 131250 12345 is a cache hit.



          You need to download special Magento VCL file from Magento admin, not use the default one.






          share|improve this answer































            0














            You can identify cache HIT or MISS by adding some code in sub vcl_deliver section of /etc/varnish/default.vcl.



            if (obj.hits > 0) {
            set resp.http.Cache-Tags = "HIT";
            }
            else {
            set resp.http.Cache-Tags = "MISS";
            }



            1. add the above code in vcl_deliver of /etc/varnish/default.vcl.

            2. reload/restart varnish.

            3. Curl -I your request

            4. Look for Cache-Tags in response header.


            Method 2:



            You can issue a command in varnish server and check the requests are hit or miss



            sudo varnishncsa -F '%U%q %{Varnish:hitmiss}x'



            If you issue above command and access the website it will show you it's a miss or hit in the command line.






            share|improve this answer


























            • Just leaving this here: info.varnish-software.com/blog/using-obj-hits clearly not worth an answer on its own, but I feel I have to fight this snippet as much as I can :-)

              – Guillaume Quintard
              Nov 22 '18 at 5:52













            • @GuillaumeQuintard Thanks Bro. That's the right way, well explained.

              – shafeeque aslam
              Nov 22 '18 at 8:35











            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2fstackoverflow.com%2fquestions%2f52844879%2fis-this-a-varnish-hit%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            It is not a cache hit.



            You can see if cache was hit by checking value of X-Varnish: 131250. Single number is a cache miss, two numbers, e.g. X-Varnish: 131250 12345 is a cache hit.



            You need to download special Magento VCL file from Magento admin, not use the default one.






            share|improve this answer




























              0














              It is not a cache hit.



              You can see if cache was hit by checking value of X-Varnish: 131250. Single number is a cache miss, two numbers, e.g. X-Varnish: 131250 12345 is a cache hit.



              You need to download special Magento VCL file from Magento admin, not use the default one.






              share|improve this answer


























                0












                0








                0







                It is not a cache hit.



                You can see if cache was hit by checking value of X-Varnish: 131250. Single number is a cache miss, two numbers, e.g. X-Varnish: 131250 12345 is a cache hit.



                You need to download special Magento VCL file from Magento admin, not use the default one.






                share|improve this answer













                It is not a cache hit.



                You can see if cache was hit by checking value of X-Varnish: 131250. Single number is a cache miss, two numbers, e.g. X-Varnish: 131250 12345 is a cache hit.



                You need to download special Magento VCL file from Magento admin, not use the default one.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Oct 16 '18 at 22:54









                Daniel V.Daniel V.

                1,89811314




                1,89811314

























                    0














                    You can identify cache HIT or MISS by adding some code in sub vcl_deliver section of /etc/varnish/default.vcl.



                    if (obj.hits > 0) {
                    set resp.http.Cache-Tags = "HIT";
                    }
                    else {
                    set resp.http.Cache-Tags = "MISS";
                    }



                    1. add the above code in vcl_deliver of /etc/varnish/default.vcl.

                    2. reload/restart varnish.

                    3. Curl -I your request

                    4. Look for Cache-Tags in response header.


                    Method 2:



                    You can issue a command in varnish server and check the requests are hit or miss



                    sudo varnishncsa -F '%U%q %{Varnish:hitmiss}x'



                    If you issue above command and access the website it will show you it's a miss or hit in the command line.






                    share|improve this answer


























                    • Just leaving this here: info.varnish-software.com/blog/using-obj-hits clearly not worth an answer on its own, but I feel I have to fight this snippet as much as I can :-)

                      – Guillaume Quintard
                      Nov 22 '18 at 5:52













                    • @GuillaumeQuintard Thanks Bro. That's the right way, well explained.

                      – shafeeque aslam
                      Nov 22 '18 at 8:35
















                    0














                    You can identify cache HIT or MISS by adding some code in sub vcl_deliver section of /etc/varnish/default.vcl.



                    if (obj.hits > 0) {
                    set resp.http.Cache-Tags = "HIT";
                    }
                    else {
                    set resp.http.Cache-Tags = "MISS";
                    }



                    1. add the above code in vcl_deliver of /etc/varnish/default.vcl.

                    2. reload/restart varnish.

                    3. Curl -I your request

                    4. Look for Cache-Tags in response header.


                    Method 2:



                    You can issue a command in varnish server and check the requests are hit or miss



                    sudo varnishncsa -F '%U%q %{Varnish:hitmiss}x'



                    If you issue above command and access the website it will show you it's a miss or hit in the command line.






                    share|improve this answer


























                    • Just leaving this here: info.varnish-software.com/blog/using-obj-hits clearly not worth an answer on its own, but I feel I have to fight this snippet as much as I can :-)

                      – Guillaume Quintard
                      Nov 22 '18 at 5:52













                    • @GuillaumeQuintard Thanks Bro. That's the right way, well explained.

                      – shafeeque aslam
                      Nov 22 '18 at 8:35














                    0












                    0








                    0







                    You can identify cache HIT or MISS by adding some code in sub vcl_deliver section of /etc/varnish/default.vcl.



                    if (obj.hits > 0) {
                    set resp.http.Cache-Tags = "HIT";
                    }
                    else {
                    set resp.http.Cache-Tags = "MISS";
                    }



                    1. add the above code in vcl_deliver of /etc/varnish/default.vcl.

                    2. reload/restart varnish.

                    3. Curl -I your request

                    4. Look for Cache-Tags in response header.


                    Method 2:



                    You can issue a command in varnish server and check the requests are hit or miss



                    sudo varnishncsa -F '%U%q %{Varnish:hitmiss}x'



                    If you issue above command and access the website it will show you it's a miss or hit in the command line.






                    share|improve this answer















                    You can identify cache HIT or MISS by adding some code in sub vcl_deliver section of /etc/varnish/default.vcl.



                    if (obj.hits > 0) {
                    set resp.http.Cache-Tags = "HIT";
                    }
                    else {
                    set resp.http.Cache-Tags = "MISS";
                    }



                    1. add the above code in vcl_deliver of /etc/varnish/default.vcl.

                    2. reload/restart varnish.

                    3. Curl -I your request

                    4. Look for Cache-Tags in response header.


                    Method 2:



                    You can issue a command in varnish server and check the requests are hit or miss



                    sudo varnishncsa -F '%U%q %{Varnish:hitmiss}x'



                    If you issue above command and access the website it will show you it's a miss or hit in the command line.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Nov 21 '18 at 6:55

























                    answered Nov 21 '18 at 6:44









                    shafeeque aslamshafeeque aslam

                    12




                    12













                    • Just leaving this here: info.varnish-software.com/blog/using-obj-hits clearly not worth an answer on its own, but I feel I have to fight this snippet as much as I can :-)

                      – Guillaume Quintard
                      Nov 22 '18 at 5:52













                    • @GuillaumeQuintard Thanks Bro. That's the right way, well explained.

                      – shafeeque aslam
                      Nov 22 '18 at 8:35



















                    • Just leaving this here: info.varnish-software.com/blog/using-obj-hits clearly not worth an answer on its own, but I feel I have to fight this snippet as much as I can :-)

                      – Guillaume Quintard
                      Nov 22 '18 at 5:52













                    • @GuillaumeQuintard Thanks Bro. That's the right way, well explained.

                      – shafeeque aslam
                      Nov 22 '18 at 8:35

















                    Just leaving this here: info.varnish-software.com/blog/using-obj-hits clearly not worth an answer on its own, but I feel I have to fight this snippet as much as I can :-)

                    – Guillaume Quintard
                    Nov 22 '18 at 5:52







                    Just leaving this here: info.varnish-software.com/blog/using-obj-hits clearly not worth an answer on its own, but I feel I have to fight this snippet as much as I can :-)

                    – Guillaume Quintard
                    Nov 22 '18 at 5:52















                    @GuillaumeQuintard Thanks Bro. That's the right way, well explained.

                    – shafeeque aslam
                    Nov 22 '18 at 8:35





                    @GuillaumeQuintard Thanks Bro. That's the right way, well explained.

                    – shafeeque aslam
                    Nov 22 '18 at 8:35


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • 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%2fstackoverflow.com%2fquestions%2f52844879%2fis-this-a-varnish-hit%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

                    Paul Cézanne

                    UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

                    Angular material date-picker (MatDatepicker) auto completes the date on focus out