Search code examples
apache2ajp

apache2 - set timeout in xml configuration of sites-enabled


I use this configuration below in order to make my application available via SSL. My question now would be how it is possible to set a timeout at **. Is there a way of doing it and how would be the syntax?

# force HTTPS
<VirtualHost *:80>
ServerName app.xy.at

RewriteEngine on
RewriteCond %{SERVER_NAME} =app.xy.at
Redirect permanent "/" https://app.xy.at
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

# forward ORDS requests to tomcat
<VirtualHost *:443>
ServerName app.xy.at

# SSL certificates settings
#Include /etc/apache2/conf-enabled/options-ssl-apache.conf
SSLCertificateFile /etc/apache2/ssl/app.xy.at/fullchain.cer
SSLCertificateKeyFile /etc/apache2/ssl/app.xy.at/app.xy.at.key
SSLCertificateChainFile /etc/apache2/ssl/app.xy.at/ca.cer

ProxyRequests on
ProxyPreserveHost On
<Location / >
    ProxyPass "ajp://localhost:9090/"
    ProxyPassReverse "ajp://localhost:9090/"
</Location>

I will set a timeout because I get the following errors:

[Thu Mar 26 00:10:52.731383 2020] [proxy_ajp:error] [pid 16266:tid 
139926293157632] [client 
xxx.xxx.3.59:60869] AH00893: dialog to 127.0.0.1:9090 (localhost) 
failed, referer: 
https domain
[Thu Mar 26 00:10:57.802571 2020] [proxy_ajp:error] [pid 16266:tid 
139926720988928] 
(70014)End of file found: AH01030: ajp_ilink_receive() can't receive 
header
[Thu Mar 26 00:10:57.802597 2020] [proxy_ajp:error] [pid 16266:tid 
139926720988928] [client 
xxx.xxx.3.59:60875] AH00992: ajp_read_header: ajp_ilink_receive 
failed, referer: 
https domain
[Thu Mar 26 00:10:57.802628 2020] [proxy_ajp:error] [pid 16266:tid 
139926720988928] 
(120006)APR does not understand this error code: [client 
xxxx.xxxx.3.59:60875] AH00878: read 
response failed from 127.0.0.1:9090 (localhost), referer: https domain

and I dont know why.


Solution

  • According to the documentation, You can pass different parameters along with the URL, in the format of key value pairs

    ProxyPass "protocol://domain.com" key1=value1 key2=value2 ...
    

    for your case,

    ProxyPass "ajp://localhost:9090/" connectiontimeout=10 timeout=50
    

    connectiontimeout : Connect timeout in seconds. The number of seconds Apache httpd waits for the creation of a connection to the backend to complete. By adding a postfix of ms, the timeout can be also set in milliseconds.

    timeout : Connection timeout in seconds. The number of seconds Apache httpd waits for data sent by / to the backend.