title: Widevine HTTP proxy with AWS Lambda
body: <p>I am building a  Widevine license proxy with AWS Lambda + Serverless and testing it out via the Shaka Player with standard content: <a href="https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd" rel="nofollow noreferrer">https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd</a>. The <code>ContentKey</code> API works fine but if I try to use the Lambda endpoint as the license URL with CENC encoded DRM content, playback fails because the Shaka player tries to make a <code>CONNECT</code> request which fails in Lambda with a <code>Unsupported HTTP method</code>, the first <code>POST</code> request for the <code>SERVICE_CERTIFICATE</code> works, the second one with the <code>PAYLOAD</code> for requesting the certificate fails. 
  Specifically this: </p>
  
  <pre><code>curl -H 'Host: drm.*****.com:443' -H 'Proxy-Connection: keep-alive' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36' -X CONNECT 'https://drm.******.com'
  </code></pre>
  
  <p>Analyzing the traffic with Charles, the failure is: <code>Client SSL handshake failed - Remote host closed connection during handshake</code> and results in <code>Unsupported HTTP method</code>.</p>
  
  <p><strong>EDIT:</strong>
  So the Shaka player is making a request for the keys to decrypt an asset to a Widevine license URL, executing on Lambda and behind API Gateway. The first POST request for the service_certificate (payload CAQ=) from the Shaka player works. The second request (the one for the license, from the Shaka player) blocks at the CONNECT step and then the connection is closed with a Unsupported HTTP Method response from the API Gateway.</p>
  
  <p>Any ideas on how to make the license server work?</p>