Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Fix problem with the robots exclusion middleware

Roland Geider1a5f1df61113
diff --git a/wger/utils/middleware.py b/wger/utils/middleware.py
index 07f8aa7c2..f5ac7f325 100644
--- a/wger/utils/middleware.py
+++ b/wger/utils/middleware.py
@@ -94,7 +94,10 @@ class RobotsExclusionMiddleware(object):
'''
def process_response(self, request, response):
# Don't set it if it's already in the response
- if check_current_request(request) and response.get('X-Robots-Tag', None) is not None:
+ if check_current_request(request) and response.get('X-Robots-Tag', None) is None:
+ #logger.debug("Adding X-Robots header")
+ response['X-Robots-Tag'] = 'noindex, nofollow'
+ return response
+ else:
+ #logger.debug("Not adding X-Robots header")
return response
- response['X-Robots-Tag'] = 'noindex, nofollow'
- return response