david.perez
david.perez

Reputation: 7012

Proxy timeout with ReWriteRule

There is no way of controlling timeout when proxying by means of ReWriteRule (mod_rewrite) with Apache 2.4.

<VirtualHost "*:443">
  ServerName xxxx
  Use ssl
  RewriteEngine On
  RewriteRule (.*/wms|/openlayers3/.*) http://localhost:8080$1 [P,L]
  RewriteRule .* [F]
</VirtualHost>

I've tried unsuccessfully:

<Proxy "http://localhost:8080/">
  ProxySet connectiontimeout=100 timeout=400
</Proxy>

The timeout is always 1 minute, no matter which of the above directives I use.

Upvotes: 4

Views: 1884

Answers (1)

ximaera
ximaera

Reputation: 2468

This timeout can be controlled only globally. Change the global Timeout setting in httpd.conf to your preferred value:

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 400

Probably a better way to do this would be to use nginx:

server {
    listen       443;
    server_name  xxxx;
    # ... ssl setup ...

    location ~* /wms$ {
        proxy_pass http://localhost:8080;
        proxy_read_timeout 400;
    }

    location /openlayers3/ {
        proxy_pass http://localhost:8080;
        proxy_read_timeout 400;
    }

    location / {
        return 403;
    }
}

Additional links to nginx documentation so that you understand what's going on in this snippet:

For the SSL configuration missing in my snippet please also read the documentation.

Upvotes: 5

Related Questions