using POST/PUT method with failover cloudfront

0

I am trying to set up a failover mechanism with AEP - Adobe experience Portal and S3 as Origins behind cloudfront using Origin Group. The AEP domain is our primary domain to serve our website but we also use HTTP POST method to submit the Login credentials. S3 is our backup wensite mainly for caching but will take PSOT method as well.

However , i do not see an option for setting up using POST/PUT method with Origin Group as per the offical documentaion . Is there a tangible workaround on the same which is less cumbersome to implement or may be a lambdaedge solution ?

asked 8 days ago96 views
1 Answer
1

Origin failover with POST or PUT method is not native or OOTB feature but with Lambda@edge you can do a workaround for the same. Essentially , here are the steps involved :

  • You can redirect ( HTTP 307) the response to same URL when using HTTP POST/PUT using Origin response Lambda code based on error code from Primary Origin when the Primary origin goes down. While redirecting , you can set up a set-cookie header with value as error=error code.

  • The subsequent POST/PUT request would hence contain a cookie with value set as "error=error code" parsed and detected by an Origin Request Lambda Function to dynamically change the Primary Origin to Failover Origin returning a success .

  • The browser stores the cookie for the Max-Age header value until which it returns the response from the Failover Origin ,however, after Max-Age value expires , it will initiate a request without the cookie and hence the response would be returned from Primary Origin if it is back otherwise the 307 will follow with above steps once again.

You can create a ticket with AWS for more details .

AWS
dhanraj
answered 7 days ago
  • Looks like this will need a more comphrensive approach ..I have created a support case - 171991574000499 .Can we discuss there ?