<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">As advised on mediawiki's wiki (
      <a class="moz-txt-link-freetext" href="https://www.mediawiki.org/wiki/Manual:Varnish_caching">https://www.mediawiki.org/wiki/Manual:Varnish_caching</a> ) <br>
      <br>
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <pre style="font-family: monospace, Courier; color: black; border: 1px solid rgb(221, 221, 221); padding: 1em; white-space: pre-wrap; line-height: 1.3em; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(249, 249, 249);"> <span class="cp" style="color: rgb(188, 122, 0);"># Pass requests from logged-in users directly.</span>
        <span class="k" style="color: rgb(0, 128, 0); font-weight: bold;">if</span> <span class="p">(</span><span class="n">req</span><span class="p">.</span><span class="n">http</span><span class="p">.</span><span class="n">Authorization</span> <span class="o" style="color: rgb(102, 102, 102);">||</span> <span class="n">req</span><span class="p">.</span><span class="n">http</span><span class="p">.</span><span class="n">Cookie</span><span class="p">)</span>
           <span class="p">{</span><span class="k" style="color: rgb(0, 128, 0); font-weight: bold;">return</span><span class="p">(</span><span class="n">pass</span><span class="p">);}</span>      <span class="cm" style="color: rgb(64, 128, 128); font-style: italic;">/* Not cacheable by default */</span>
 </pre>
      you could also check req.http.Cookie's content to check if the
      session cookie is there, and not unset them in this case. In other
      cases when user is not logged in, it's probably safe to unset them
      and show the static version of the page from cache, instead of the
      logged in version.<br>
      <br>
      <br>
      <br>
      <br>
      Regards<span class="HOEnZb"><font color="#888888"><br>
          Balder</font></span><br>
      <br>
      On 08/17/2015 05:52 PM, Tim Dunphy wrote:<br>
    </div>
    <blockquote
cite="mid:CAOZy0enkLrnBo3ZciXeC2zDeCr8YK2uL5Zk-cLgmsvbLbzqmSw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span
            style="font-size:12.8000001907349px">maybe you have a  unset
            req.http.Cookie; that shouldn't be called when a user is
            logged in/going to login.</span><br
            style="font-size:12.8000001907349px">
          <span style="font-size:12.8000001907349px">Maybe try to find a
            way to always call (pass) when a user is logged in. I think
            you 'd be better of not caching when a user is logged in.<br>
          </span><span style="font-size:12.8000001907349px">Of course we
            don't know the use case of your mediawiki, nor do I know
            mediawiki myself . </span></blockquote>
        <div><br>
        </div>
        That was it! I did in fact have <span
          style="font-size:12.8000001907349px"> unset req.http.Cookie;
          set earlier in my VCL! So now I can log in. Good stuff!
          However if I disable  unset req.http.Cookie; altogether my
          site does not cache at all. Is there any way to allow cookies
          just for the login page in the following section?</span><br>
        <br>
        <div><span style="font-size:12.8000001907349px"> if (
            req.http.host == "<a moz-do-not-send="true"
              href="http://wiki.example.com">wiki.example.com</a>"
            && req.url ~
             "^/(index\.php)?\?title=Special:UserLogin(.*)" ) {</span></div>
        <div><span style="font-size:12.8000001907349px">    return
            (pass) ;</span></div>
        <div><span style="font-size:12.8000001907349px">   }<br>
            <br>
            Thanks,</span></div>
        <div><span style="font-size:12.8000001907349px">TIm</span></div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Mon, Aug 17, 2015 at 11:27 AM,
          Balder VC <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:lists@redlab.be" target="_blank">lists@redlab.be</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"><span class=""> On
                08/17/2015 05:02 PM, Tim Dunphy wrote:<br>
              </span><span style="white-space:pre-wrap"><span class=""><br>
                  ><br>
                  > So I think I need to find a way to preserve the
                  cookie that's being used to identify the user at the
                  end of the URL, which I'm pretty sure will be a random
                  string. Can you help me find a way to do this?<br>
                  ><br>
                  > Thanks,<br>
                  > Tim<br>
                  ><br>
                </span> > On Mon, Aug 17, 2015 at 2:24 AM, Geoff
                Simmons <<a moz-do-not-send="true"
                  href="mailto:geoff@uplex.de" target="_blank">geoff@uplex.de</a>
                <a moz-do-not-send="true" href="mailto:geoff@uplex.de"
                  target="_blank"><mailto:geoff@uplex.de></a>>
                wrote:<br>
                ></span><br>
              <br>
              <br>
              maybe you have a  unset req.http.Cookie; that shouldn't be
              called when a user is logged in/going to login.<br>
              <br>
              Maybe try to find a way to always call (pass) when a user
              is logged in. I think you 'd be better of not caching when
              a user is logged in.<br>
              Of course we don't know the use case of your mediawiki,
              nor do I know mediawiki myself . <br>
              <br>
              <br>
              Regards<span class="HOEnZb"><font color="#888888"><br>
                  Balder<br>
                </font></span></div>
            <br>
            _______________________________________________<br>
            varnish-misc mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
            <a moz-do-not-send="true"
              href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc"
              rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature">GPG me!!<br>
          <br>
          gpg --keyserver <a moz-do-not-send="true"
            href="http://pool.sks-keyservers.net" target="_blank">pool.sks-keyservers.net</a>
          --recv-keys F186197B<br>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>