title: AWS Cloudfront remove particular cookie before sending to origin
body: <p>I want to remove particular cookie in aws cloudfront before sending to the origin server.
  I have to send all cookies to origin except cookie named <code>"_x_ad_zone"</code>.</p>
  
  <p>I could not find any option to remove particular cookie in cloud front configuration. I believe that we have to achieve with lambda, but I have no clue how to do it.</p>
  
  <p>Please let me know how can I achieve the same.</p>
  
  <p>[EDIT]
  Based on the answer, I wrote the following lambda@edge to solve my issue.</p>
  
  <pre><code>exports.handler = (event, context, callback) =&gt; {
      const request = event.Records[0].cf.request;
      const headers = request.headers;
  
      const cookieName = '__a_x_id';
  
      /*
       * Lambda at the Edge headers are array objects.
       *
       * Client may send multiple Cookie headers, i.e.:
       * &gt; GET /viewerRes/test HTTP/1.1
       * &gt; User-Agent: curl/7.18.1 (x86_64-unknown-linux-gnu) libcurl/7.18.1 OpenSSL/1.0.1u zlib/1.2.3
       * &gt; Cookie: First=1; Second=2
       * &gt; Cookie: ClientCode=abc
       * &gt; Host: example.com
       *
       * You can access the first Cookie header at headers["cookie"][0].value
       * and the second at headers["cookie"][1].value.
       *
       * Header values are not parsed. In the example above,
       * headers["cookie"][0].value is equal to "First=1; Second=2"
       */
      console.log(headers.cookie);
      // Delete the cookie if found
      if (headers.cookie) {
          for (let i = 0; i &lt; headers.cookie.length; i++) {
              console.log(headers.cookie[i].value);
              if (headers.cookie[i].value.indexOf(cookieName) &gt;= 0) {
                  console.log('Adblocker cookie found and delete: '+headers.cookie[i].value);
                  headers.cookie[i].value = "0";
                  break;
              }
          }
          request.headers = headers;
      }
  
      callback(null, request);
  };
  </code></pre>