You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by gc...@apache.org on 2022/05/17 15:50:55 UTC
[allura] branch gc/8429 updated: fixup! [#8429] limiting /auth/ to noindex,follow only if query string in url
This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a commit to branch gc/8429
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/gc/8429 by this push:
new df567ac2a fixup! [#8429] limiting /auth/ to noindex,follow only if query string in url
df567ac2a is described below
commit df567ac2a697308dccf84f54020697ce1e7aff3d
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Tue May 17 09:50:49 2022 -0600
fixup! [#8429] limiting /auth/ to noindex,follow only if query string in url
---
Allura/allura/lib/custom_middleware.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py
index 409ff94ff..ca97111f0 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -155,19 +155,17 @@ class LoginRedirectMiddleware:
def __call__(self, environ, start_response):
status, headers, app_iter, exc_info = call_wsgi_application(self.app, environ)
is_api_request = environ.get('PATH_INFO', '').startswith('/rest/')
- noindex_headers = False
if status[:3] == '401' and not is_api_request and not is_ajax(Request(environ)):
login_url = tg.config.get('auth.login_url', '/auth/')
if environ['REQUEST_METHOD'] == 'GET':
return_to = environ['PATH_INFO']
if environ.get('QUERY_STRING'):
return_to += '?' + environ['QUERY_STRING']
- noindex_headers = True
location = tg.url(login_url, dict(return_to=return_to))
else:
# Don't try to re-post; the body has been lost.
location = tg.url(login_url)
- r = exc.HTTPFound(location=location, headers={'X-Robots-Tag': 'noindex,follow'} if noindex_headers else {})
+ r = exc.HTTPFound(location=location, headers={'X-Robots-Tag': 'noindex,follow'})
return r(environ, start_response)
start_response(status, headers, exc_info)
return app_iter