[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[users@httpd] mod proxy, SSI and Options Includes

Hi All,


Good day All.


We are having an issue - Server Side Includes are not working properly when the request is being proxy to Tomcat from Apache server. It is working only when we set the “Options +Includes” in the <proxy> element. Can you please suggest is the intended behavior.


When the Apache HTTP server is used standalone mode (means without using Tomcat), SSI is working properly.


Steps to reproduce:

In the Apache httpd.conf file,

1) Enable following modules.

                LoadModule include_module modules/mod_include.so

                LoadModule proxy_module modules/mod_proxy.so

                LoadModule proxy_http_module modules/mod_proxy_http.so

                LoadModule proxy_connect_module modules/mod_proxy_connect.so

2) Add "Includes" directive to the directory

                <Directory />

                                Options Includes Indexes FollowSymLinks


3) Add following configuration for proxy to Tomcat which is running at port 8080.


<IfModule mod_proxy.c>

                ProxyRequests Off

                ProxyPass / http://localhost:8080/

                ProxyPassReverse / http://localhost:8080/



<Proxy *>

                Order deny,allow

                Allow from all

                Options +Includes



4) Restart Apache server.


Changes to be done on Tomcat server:

1) Open the file \tomcat\conf\web.xml text editor.

2) Uncomment the ssi filter, which looks like below.























3) Uncomment the filter mapping, which looks like below.





4) Uncomment the mime mapping, which looks like below.





5) Go to \tomcat\webapps\ROOT directory, and create a below two files

                Create a file named main.shtml, with below content.





                                                <!--#include virtual="/sub.html" -->   




                Create a file named sub.html, with below content.





                                                <!--#echo var="DATE_LOCAL"--><br>

                                                <!--#echo var="DATE_GMT"--><br>

                                                Good <!--#if expr="%{TIME_HOUR} <12" -->


                                                                <!--#else -->


                                                                <!--#endif -->




6) Open the file \tomcat\conf\context.xml in text editor and add the attribute "privileged" to the context node, to look like below.

                <Context privileged="true">

7) Restart tomcat server.



Steps to test:

1) In the web browser request for the url http://localhost/main.shtml

2) It should show the content as below.


                                main.shtml sub.html

                                Thursday, 01-Nov-2018 12:39:44 India Standard Time

                                Thursday, 01-Nov-2018 07:09:44 GMT

                                Good afternoon!


3) One can note that SSI content from sub.html is included in the response above.

4) Open the httpd.conf file and remove the "Options +Includes" directive from the <proxy> node.

5) Restart Apache HTTP server.

6) Request the page again as in step-1, it shows below content.

                                main.shtml sub.html      


                                Good morning! afternoon!


7) From above, one can notice that SSI script kept inside main.shtml are honored but not honored which kept in the sub.html file.

8) One can also notice a warning in the log, saying-

                [client] AH01374: mod_include: Options +Includes (or IncludesNoExec) wasn't set, INCLUDES filter removed: /main.shtml



Similar to this, there was Bug 33089, where they used "Options +Includes" in the global level. But this also not documented. In the API, nowhere mentioned Options directive can be used at global level.



1) Should we need to add Options +Includes in the <proxy> container to get proxy SSI to work?

2) As per docs, Options directive can be used in <directory> only. Is it also supposed to use at <proxy>?