mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-10 00:42:06 +00:00
Remove the "is behind cache" functionality
We're always behind cache now (we may or may not be cached, but that's not what this check was about)
This commit is contained in:
@ -19,7 +19,7 @@ from pgweb.util.decorators import cache, nocache
|
||||
from pgweb.util.contexts import NavContext
|
||||
from pgweb.util.helpers import simple_form, PgXmlHelper, HttpServerError
|
||||
from pgweb.util.moderation import get_all_pending_moderations
|
||||
from pgweb.util.misc import get_client_ip, is_behind_cache, varnish_purge
|
||||
from pgweb.util.misc import get_client_ip, varnish_purge
|
||||
from pgweb.util.sitestruct import get_all_pages_struct
|
||||
|
||||
# models needed for the pieces on the frontpage
|
||||
@ -219,16 +219,7 @@ def csrf_failure(request, reason=''):
|
||||
def system_information(request):
|
||||
return render_to_response('core/system_information.html', {
|
||||
'server': os.uname()[1],
|
||||
'behind_cache': is_behind_cache(request),
|
||||
'cache_server': is_behind_cache(request) and request.META['REMOTE_ADDR'] or None,
|
||||
'client_ip': get_client_ip(request),
|
||||
})
|
||||
|
||||
def system_information_ssl(request):
|
||||
return render_to_response('core/system_information.html', {
|
||||
'server': os.uname()[1],
|
||||
'behind_cache': False,
|
||||
'cache_server': None,
|
||||
'cache_server': request.META['REMOTE_ADDR'] or None,
|
||||
'client_ip': get_client_ip(request),
|
||||
})
|
||||
|
||||
|
@ -118,7 +118,6 @@ urlpatterns = patterns('',
|
||||
|
||||
# Some basic information about the connection (for debugging purposes)
|
||||
(r'^system_information/$', 'pgweb.core.views.system_information'),
|
||||
(r'^system_information_ssl/$', 'pgweb.core.views.system_information_ssl'),
|
||||
# Sync timestamp, for automirror
|
||||
(r'^web_sync_timestamp$', 'pgweb.core.views.sync_timestamp'),
|
||||
|
||||
|
@ -13,28 +13,6 @@ def send_template_mail(sender, receiver, subject, templatename, templateattr={},
|
||||
template_to_string(templatename, templateattr),
|
||||
usergenerated=usergenerated)
|
||||
|
||||
def is_behind_cache(request):
|
||||
"""
|
||||
Determine if the client is behind a cache. In this, we are only interested in our own
|
||||
frontend caches, we don't care about any client side caches or such things.
|
||||
"""
|
||||
if request.is_secure():
|
||||
# We never proxy https requests, so shortcut the check if it's there
|
||||
return False
|
||||
|
||||
if request.META.has_key('HTTP_X_VARNISH'):
|
||||
# So, it's a varnish cache. Check that it's one of our frontends
|
||||
if request.META['REMOTE_ADDR'] in settings.FRONTEND_SERVERS:
|
||||
# Yup, it's one of our varnish servers, so we're behind a cache
|
||||
return True
|
||||
else:
|
||||
# It's someone elses varnish? Or misconfigured? Either way, don't claim
|
||||
# it's behind a cache.
|
||||
return False
|
||||
# X-Varnish not set, clearly we're not behind a cache
|
||||
return False
|
||||
|
||||
|
||||
def get_client_ip(request):
|
||||
"""
|
||||
Get the IP of the client. If the client is served through our Varnish caches,
|
||||
|
@ -6,7 +6,6 @@
|
||||
<p>
|
||||
Page generated on server: {{server}}<br/>
|
||||
Page generated at: {% now "r" %}<br/>
|
||||
Behind cache: {{behind_cache|yesno|capfirst}}<br/>
|
||||
Cache server: {{cache_server}}<br/>
|
||||
Client IP: {{client_ip}}<br/>
|
||||
</p>
|
||||
|
Reference in New Issue
Block a user