2

Hi I have a dynamic application that has a search form. I'm trying to use CloudFront with a load balancer. When you do a search the application creates some URL parameters and reloads the page. For some reason cloudfront is doing a 302 redirect back to the origin. Does anybody know how to fix this?

I have the following configuration.

enter image description here

Code Junkie
  • 7,602
  • 26
  • 79
  • 141
  • There's nothing in the origin server or load balancer logs for the 302? Can you capture the request and reaponse headers from this redirect? – Michael - sqlbot Nov 19 '14 at 11:10

1 Answers1

3

It's clear that you're going to want to turn on Forward Query Strings. Without it, cloudfront will treat the following urls as the same:

http://www.example.com
http://www.example.com?q=search_term
http://www.example.com?q=search_term&option=true

It's however not clear to me that this would result in 302 to the original url (btw. origin means something very specific when dealing with cloudfront/other cdns - it's often short for origin server which is the source behind the cdn)

The 302 redirect is much more likely to your Viewer Protocol Policy, which you have set http requests to redirect to http. You should double check that your application isn't reloading the http version of the page.

Liyan Chang
  • 7,721
  • 3
  • 39
  • 59