Skip to content

Commit

Permalink
[Fixes #9673] Proxy must use OGC_REQUEST_TIMEOUT instead of an hardco…
Browse files Browse the repository at this point in the history
…ded one (#9674) (#9675)

Co-authored-by: Alessio Fabiani <[email protected]>
  • Loading branch information
github-actions[bot] and afabiani authored Jul 15, 2022
1 parent a07d8e2 commit c2e0828
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions geonode/proxy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ def proxy(request, url=None, response_callback=None,
sec_chk_hosts=True, sec_chk_rules=True, timeout=None,
allowed_hosts=[], **kwargs):
# Request default timeout
from geonode.geoserver.helpers import ogc_server_settings
if not timeout:
timeout = TIMEOUT
timeout = getattr(ogc_server_settings, "TIMEOUT", TIMEOUT)

# Security rules and settings
PROXY_ALLOWED_HOSTS = getattr(settings, 'PROXY_ALLOWED_HOSTS', ())
Expand Down Expand Up @@ -105,13 +106,11 @@ def proxy(request, url=None, response_callback=None,
PROXY_ALLOWED_HOSTS += (site_url.hostname, )

# Attach current hostname
if check_ogc_backend(geoserver.BACKEND_PACKAGE):
from geonode.geoserver.helpers import ogc_server_settings
hostname = (
ogc_server_settings.hostname,
) if ogc_server_settings else ()
if hostname not in PROXY_ALLOWED_HOSTS:
PROXY_ALLOWED_HOSTS += hostname
hostname = (
ogc_server_settings.hostname,
) if ogc_server_settings else ()
if hostname not in PROXY_ALLOWED_HOSTS:
PROXY_ALLOWED_HOSTS += hostname

# Check OWS regexp
if url.query and ows_regexp.match(url.query):
Expand Down

0 comments on commit c2e0828

Please sign in to comment.