Skip to content

vary should be set to 'Accept' in the response header #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/image-handler/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ def request_thumbor(original_request, session):
vary, request_headers = auto_webp(original_request, request_headers)
return session.get(unix_path + http_path, headers=request_headers), vary

def process_thumbor_responde(thumbor_response, vary):
def process_thumbor_response(thumbor_response, vary):
if thumbor_response.status_code != 200:
return response_formater(status_code=thumbor_response.status_code)
if vary:
vary = thumbor_response.headers['vary']
vary = 'Accept'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@omrisiri We don't need to change anything here. If we forward the headers from cloudfront (https://aws.amazon.com/premiumsupport/knowledge-center/configure-cloudfront-to-forward-headers/ choose accept instead of host), this will work as it is. And I think we will have to forward the headers anyway since the thumbor needs to know the header value.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

content_type = thumbor_response.headers['content-type']
body = gen_body(content_type, thumbor_response.content)
# SO-SIH-173 - 08/20/2018 - Lambda payload limit
Expand Down Expand Up @@ -329,7 +329,7 @@ def call_thumbor(original_request):
if thumbor_down:
return thumbor_down
thumbor_response, vary = request_thumbor(original_request, session)
return process_thumbor_responde(thumbor_response, vary)
return process_thumbor_response(thumbor_response, vary)

def lambda_handler(event, context):
"""
Expand Down