Bug 999131 - Server side includes (SSI) are not working.
Server side includes (SSI) are not working.
Status: CLOSED WORKSFORME
Product: Fedora
Classification: Fedora
Component: httpd (Show other bugs)
19
x86_64 Linux
unspecified Severity urgent
: ---
: ---
Assigned To: Joe Orton
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-20 15:13 EDT by John Griffiths
Modified: 2014-01-24 10:59 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-01-07 06:37:29 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
httpd.conf file (11.54 KB, text/plain)
2013-12-19 03:07 EST, John Griffiths
no flags Details
The index.shtml file (4.54 KB, text/html)
2013-12-19 03:09 EST, John Griffiths
no flags Details

  None (edit)
Description John Griffiths 2013-08-20 15:13:00 EDT
Description of problem:
Server Side Includes are not working in Apache.

Version-Release number of selected component (if applicable):
httpd-2.4.6-2.fc19.x86_64

How reproducible:
always

Steps to Reproduce:
1. serve a page that has SSI
2. The SSI is not rendered.
3.

Here is one of the SSI lines in the html source.

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

Actual results:
The html included in the links01.html is not served.


Expected results:
The html included in the links01.html should be served.

Additional info:

I have several virtual hosts. This happens on all of them.
The httpd.conf has the shtml type added and +Includes in the Options and also has the XBitHack enabled. Here are excerpts from the httpd.conf file.

<Directory "/var/www/html">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options +Indexes +FollowSymLinks +Includes

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride  AuthConfig Options

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

...

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml

...

#
# XBitHack allows server-side includes (SSI)
#
<IfModule include_module>
XBitHack on
</IfModule>

...

# Default server must be first
# XXXXXX
<VirtualHost *:80>
    ServerAdmin webmaster@xxxxxxxxxxx.com
# ---- On line ----
#    ServerName www.xxxxxxxxxxx.com
#    ServerAlias xxxxxxxxxxx.com *.xxxxxxxxxxx.com
# ---- Off line ----
    ServerName xxxxxxxxxxx.internal.xxxxxxxxxxx.com
    ServerAlias xxxxxxxxxxx
    DocumentRoot "/var/www/xxxxxxxxxxx
    
    <Directory "/var/www/xxxxxxxxxxx">
    
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
        Options +Indexes +SymLinksifOwnerMatch +Includes
    
    #

...
Comment 1 Joe Orton 2013-08-20 15:50:33 EDT
If you put "XBitHack on" directly inside one of the <Directory> stanzas where SSI is not working, does that help?
Comment 2 John Griffiths 2013-08-20 16:51:04 EDT
No. Adding the "XBitHack on" directly inside the virtual server directories does not help.
Comment 3 John Griffiths 2013-08-20 16:57:34 EDT
Seems I am not the only one experiencing problems with SSI not working in 2.4.

http://support.godaddy.com/groups/web-hosting/forum/topic/apache-2-4-upgrade-broke-ssi-use/
Comment 4 Joe Orton 2013-08-20 17:05:27 EDT
That looks different.  Is the SSI being processed or not in your case?  i.e. do you get the raw unprocessed SSI output from the server?
Comment 5 John Griffiths 2013-08-20 19:21:21 EDT
You are correct. Sorry. That is different.

I am getting no output from the SSI.

This is a snippet of the generated source under 2.4.

<body id="home">

<div id="container">

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


This is the same snippet from the same page served by 2.2.

<body id="home">

<div id="container">

	<!-- This is the code to produce the page links to other portions of the web site -->
	<div id="extraDiv1"><span>Shuri-mon gate, small image</span></div>

	<div id="linkList">
		<div id="linkList2">
			<div id="lselect">
				<h4 class="select"><span>Select an Area:</span></h4>
				<ul>
					<li>
						<a href="/" title="AccessKey: H" accesskey="H"><span class="accesskey">H</span>ome</a>
					</li>
					<!--
					<li>
						<a href="/membership/" title="AccessKey: B" accesskey="A"><span class="accesskey">B</span>ecome a Member</a>
					</li>
					-->
					<li>
						<a href="/associationLinage/" title="AccessKey: A" accesskey="A"><span class="accesskey">A</span>ssociation Linage</a>
					</li>
					<li>
						<a href="/Seminars/" title="AccessKey: n" accesskey="n">Semi<span class="accesskey">n</span>ars</a>
					</li>
					<li>
						<a href="/News/" title="AccessKey: w" accesskey="w">Ne<span class="accesskey">w</span>s</a>
					</li>
					<li>
						<a href="/store/" title="AccessKey: S" accesskey="S"><span class="accesskey">S</span>tore</a>
					</li>
					<li>
						<a href="/contactUs/" title="AccessKey: C" accesskey="C"><span class="accesskey">C</span>ontact Us</a>
					</li>
				</ul>
			</div>

			<div id="lmembers">
				<h4 class="members"><span>Members Only:</span></h4>
				<ul>
					<li>
						<a href="/membersArea/" title="AccessKey: M" accesskey="M"><span class="accesskey">M</span>embers' Area</a>
					</li>
					<li>
						<a href="/membersArea/history/" title="AccessKey: i" accesskey="i">H<span class="accesskey">i</span>story</a>
					</li>
<!-- Comment out the dojos
					<li>
						<a href="/membersArea/memberDojos/" title="AccessKey: D" accesskey="D">Member <span class="accesskey">D</span>ojos</a>
					</li>
-->
					<li>
						<a href="/membersArea/pictures/" title="AccessKey: P" accesskey="P"><span class="accesskey">P</span>ictures</a>
					</li>
					<li>
						<a href="/membersArea/store/" title="AccessKey: e" accesskey="e">M<span class="accesskey">e</span>mbers' Store</a>
					</li>
				</ul>
			</div>

			<div id="lsenseis">
				<h4 class="senseis"><span>Senseis Only:</span></h4>
				<ul>
					<li>
						<a href="/senseisArea/" title="AccessKey: r" accesskey="r">Senseis' A<span class="accesskey">r</span>ea</a>
					</li>
				</ul>
			</div>
		</div>
	</div>
Comment 6 Jan Kaluža 2013-08-21 02:10:15 EDT
I don't know why it works in 2.2 and not in 2.4, but maybe the not-working state can be caused by some .htaccess overriding default Options defined in main httpd.conf?
Comment 7 John Griffiths 2013-08-21 09:20:55 EDT
No .htaccess files involved.
Comment 8 Jan Kaluža 2013-09-02 09:31:19 EDT
Hm, I'm still not able to reproduce it. Could you try to reproduce it with minimal httpd config with clean httpd installation? I have no clue right now why this doesn't work for you...
Comment 9 John Griffiths 2013-09-03 12:39:11 EDT
It will take a couple of days to get to this.
Comment 10 John Griffiths 2013-12-19 03:06:12 EST
Took more than a couple of days. Sorry.

I completely removed my httpd.conf file and used the pristine file that was installed with the httpd rpm. 

I copied the /usr/share/httpd/noindex/index.html to /var/www/html/index.shtml. Notice the extension change.

I modified the httpd.conf line specifying index files so that index.shtml files would be seen as directory index files in addition to index.html files.
   DirectoryIndex index.html index.shtml

I made a textual modification to the index.shtml to make sure that it was being parsed by the server; I prepended "Test n" where n is a number to ".If you are a member of the general public:"

I added the line:
<!--#echo var="DATE_LOCAL" --> 
to various places in the file incrementing n so that I could be sure the file change had been served by the server.

Each time the server served the file with the correct n, but never included the date.

This is as plain vanilla as I can get. SSI is not being parsed.

I then added the xbit hack and change the permissions on /var/www/html/index.shtml tp 755. I restarted the server. Still no SSI was parsed.
Comment 11 John Griffiths 2013-12-19 03:07:44 EST
Created attachment 838795 [details]
httpd.conf file
Comment 12 John Griffiths 2013-12-19 03:09:28 EST
Created attachment 838796 [details]
The index.shtml file
Comment 13 Jan Kaluža 2014-01-06 03:51:38 EST
Sorry for late response, I was away during Christmas. I have tried your httpd.conf and index.shtml and the problem is you are missing "Options Includes" inside <Directory "/var/www/html">. If I add this option there, SSI works as expected.

See http://httpd.apache.org/docs/current/mod/mod_include.html#enabling for more info.
Comment 14 Joe Orton 2014-01-07 06:37:29 EST
Closing based on comment 13.
Comment 15 John Griffiths 2014-01-24 10:59:58 EST
My index files were xhtml files and used the .xhtml extent.

The configuration file had:

<IfModule mime_module>
    #
 ... other directives

    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>

I renamed my index file to index.shtml and SSI worked. So I added .xhtml to the mime_module.

<IfModule mime_module>
    #
 ... other directives

    AddType text/html .shtml .xhtml
    AddOutputFilter INCLUDES .shtml .xhtml
</IfModule>

And SSI worked with my .xhtml files.

Note You need to log in before you can comment on or make changes to this bug.