<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="padding-bottom: 10px; padding-top: 5px;">
<div style="padding:12px; border:1px solid #8D3970; background-color:#F7F9FA; color:#8D3970; font-size:14px; line-height:22px; font-family: Calibri, Arial, Helvetica, sans-serif;">
<strong>CAUTION:</strong> This e-mail originated outside the University of Southampton.
</div>
</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Jens,<br>
I'm glad it helped a bit - even if it wasn't a solution. A few more musings below.&nbsp;I think there must be a way to make it work.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The key is possibly in the PerlOutputFilterHandler.&nbsp;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
In a cgi script, something like (entirely untested! Just thinking out loud...):</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
##############</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">use Apache2::Filter;
<div>use Apache2::SSI;</div>
<div><br>
</div>
<div>my $r = $repo-&gt;get_request;</div>
<div><br>
</div>
$r-&gt;add_output_filter(\&amp;Apache2::SSI::handler);<br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;"># do stuff, return page</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
##############<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">If you get it working, and you wanted it to apply to all cgi requests, you could put something similar in a URL rewrite trigger that matches 'cgi'.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">Make sure the rewrite trigger&nbsp;<b>does not</b>​ set a return code - so the normal handlers will then process the actual request.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Cheers,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
John</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> jens.witzel@uzh.ch &lt;jens.witzel@uzh.ch&gt;<br>
<b>Sent:</b> 07 May 2021 13:28<br>
<b>To:</b> John Salter &lt;J.Salter@leeds.ac.uk&gt;<br>
<b>Cc:</b> eprints-tech@ecs.soton.ac.uk &lt;eprints-tech@ecs.soton.ac.uk&gt;; jens.witzel@uzh.ch &lt;jens.witzel@uzh.ch&gt;<br>
<b>Subject:</b> Antwort: RE: [EP-tech] Short question about SSI in dynamic CGI output</font>
<div>&nbsp;</div>
</div>
<div>
<p><font size="2" face="sans-serif">Dear John</font><br>
<br>
<font size="2" face="sans-serif">thank you for your thoughts on the topic. You're right: after testing a lot it really looks like the request for a CGI script does not trigger the SSI handler. We've got to go the perl-based way rather than SSI.<br>
<br>
Kind regards<br>
Jens</font><br>
<br>
<font size="2" face="sans-serif">-- <br>
Jens Witzel<br>
Zentrale Informatik<br>
Universität Zürich<br>
Stampfenbachstrasse 73<br>
CH-8006 Zürich<br>
<br>
mail: &nbsp;jens.witzel@uzh.ch<br>
phone: +41 44 63 56777<br>
<a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.zi.uzh.ch%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Caca1a5ed3ec24706fcab08d911671285%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637559956647480527%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=xWFF3TDrEmERTgYQBqPygwKyli1L3BpyeUNcOg4mV%2F4%3D&amp;reserved=0" originalSrc="http://www.zi.uzh.ch/" shash="Pd5v1XUhINbBhiKzSid8j9AAr3oyM+eCM8XThdHrEtg4TTkcpcg0LuorYt+d+5h7DBa61dVOiaQ/Px58U6AO5qoLV4VaDaflxiSDfnuHqoFwCqbQlYXT3tDe4QaCYoDBZDrN79441Z0ssXqliOQYa9oyXhsziFlx7rvnTBt3wVQ=">http://www.zi.uzh.ch</a></font><br>
<br>
<img width="16" height="16" border="0" alt="Inactive hide details for &quot;John Salter&quot; ---20.04.2021 18:11:15---Hmmm, good question! If you print an SSI instruction directly " data-outlook-trace="F:1|T:1" src="cid:1__=4EBB0C5DDFD790648f9e8a93df938690918c4EBB0C5DDFD79064@lotus.uzh.ch"><font size="2" color="#424282" face="sans-serif">&quot;John
 Salter&quot; ---20.04.2021 18:11:15---Hmmm, good question! If you print an SSI instruction directly from the CGI script, does that get con</font><br>
<br>
<font size="1" color="#5F5F5F" face="sans-serif">Von: </font><font size="1" face="sans-serif">&quot;John Salter&quot; &lt;J.Salter@leeds.ac.uk&gt;</font><br>
<font size="1" color="#5F5F5F" face="sans-serif">An: </font><font size="1" face="sans-serif">&quot;eprints-tech@ecs.soton.ac.uk&quot; &lt;eprints-tech@ecs.soton.ac.uk&gt;, &quot;jens.witzel@uzh.ch&quot; &lt;jens.witzel@uzh.ch&gt;</font><br>
<font size="1" color="#5F5F5F" face="sans-serif">Datum: </font><font size="1" face="sans-serif">20.04.2021 18:11</font><br>
<font size="1" color="#5F5F5F" face="sans-serif">Betreff: </font><font size="1" face="sans-serif">RE: [EP-tech] Short question about SSI in dynamic CGI output</font><br>
</p>
<hr width="100%" size="2" align="left" noshade="" style="color:#8091A5">
<br>
<br>
<br>
<font size="2" color="#1F497D" face="Calibri">Hmmm, good question!<br>
</font><br>
<font size="2" color="#1F497D" face="Calibri">If you print an SSI instruction directly from the CGI script, does that get converted as expected? E.g. does</font><br>
<font size="3" face="Courier New">print '&lt;!--#echo var=&quot;DATE_LOCAL&quot; --&gt;';</font><font size="2" color="#1F497D" face="Calibri"><br>
output a date, or '&lt;!--#echo…'?</font><br>
<font size="2" color="#1F497D" face="Calibri">&nbsp;</font><br>
<font size="2" color="#1F497D" face="Calibri">I haven't used SSIs alongside EPrints, but if the above doesn't interpret the SSI instruction my guess would be the PerlResponseHandler used for CGI scripts within EPrints::Apache::Rewrite module.</font><br>
<font size="2" color="#1F497D" face="Calibri"><br>
I find the diagram here: </font><a href="https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fperl.apache.org%2Fdocs%2F2.0%2Fuser%2Fhandlers%2Fhttp.html%23HTTP_Request_Cycle_Phases&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Caca1a5ed3ec24706fcab08d911671285%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637559956647480527%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=TBUPPIGnIEjuXhx5NdwuaKeanQEdGIy3ic63r76ZEk0%3D&amp;reserved=0" originalSrc="https://perl.apache.org/docs/2.0/user/handlers/http.html#HTTP_Request_Cycle_Phases" shash="Ee0Y/Yf5Q2ieEokSJIVa/4eCzmVew24kMfhd0MB6sSpckn0dvT8BJFFIJZvgqJ47KP5vuXYsnHlQINuaeS07Oujvg5UejeRRUTq0l/GJc8nCEF4yyEXZpjJr5BLhP//35NAdirorl59FBJj8JiOn3p77Iaq15yr4m+wt+inCdBM="><font size="2" color="#0000FF" face="Calibri"><u>https://perl.apache.org/docs/2.0/user/handlers/http.html#HTTP_Request_Cycle_Phases</u></font></a><font size="2" color="#1F497D" face="Calibri">&nbsp;useful
 to try and work out what the difference might be between e.g. a static page+template being served compared to a cgi script.<br>
<br>
The request for a CGI script might not trigger the SSI handler - but you may be able to add it to the stack, or a different phase (or even the output handlers).</font><br>
<font size="2" color="#1F497D" face="Calibri">&nbsp;</font><br>
<font size="2" color="#1F497D" face="Calibri">The start of this page: </font><a href="https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2Fw%2FHow_to_enable_server_side_includes&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Caca1a5ed3ec24706fcab08d911671285%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637559956647490484%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Tp0OL1NQDWIku39GQpM9UMF3NG6QemYiPqT2a9C%2FNlA%3D&amp;reserved=0" originalSrc="https://wiki.eprints.org/w/How_to_enable_server_side_includes" shash="x6bllmR/tnt5TsyQeVwy9RiPKj87KyaUdCM7c5YMsG+XgRGDn4NHPI9jeFYEETIZu54Tx7tyhRvYOfpHD200dxcgoJ8Tt8mAyK0LTY6UZPx8S+xCp4pnv+quqOoh8oDf3iQTBi14MLBknULalmWNXzjckYnh9oBXzkMFKNLVw1s="><font size="2" color="#0000FF" face="Calibri"><u>https://wiki.eprints.org/w/How_to_enable_server_side_includes</u></font></a><font size="2" color="#1F497D" face="Calibri">&nbsp;indicates
 that someone has been down this path before:<br>
&quot;If you want to add dynamic content to the template you should do this via a template part in cfg.d/dynamic_template.pl&quot;<br>
</font><br>
<font size="2" color="#1F497D" face="Calibri">They possibly included a maintenance.ssi file using perl-based methods rather than SSI methods?</font><br>
<font size="2" color="#1F497D" face="Calibri">&nbsp;</font><br>
<font size="2" color="#1F497D" face="Calibri">Cheers,</font><br>
<font size="2" color="#1F497D" face="Calibri">John</font><br>
<font size="2" color="#1F497D" face="Calibri">&nbsp;</font><br>
<font size="2" face="Calibri"><b>From:</b></font><font size="2" face="Calibri">&nbsp;eprints-tech-bounces@ecs.soton.ac.uk [</font><font size="2" face="Calibri"><a href="mailto:eprints-tech-bounces@ecs.soton.ac.uk">mailto:eprints-tech-bounces@ecs.soton.ac.uk</a></font><font size="2" face="Calibri">]
</font><font size="2" face="Calibri"><b>On Behalf Of </b></font><font size="2" face="Calibri">jens.witzel--- via Eprints-tech</font><font size="2" face="Calibri"><b><br>
Sent:</b></font><font size="2" face="Calibri">&nbsp;20 April 2021 16:06</font><font size="2" face="Calibri"><b><br>
To:</b></font><font size="2" face="Calibri">&nbsp;eprints-tech@ecs.soton.ac.uk</font><font size="2" face="Calibri"><b><br>
Subject:</b></font><font size="2" face="Calibri">&nbsp;[EP-tech] Short question about SSI in dynamic CGI output</font><br>
<font size="3" face="Times New Roman">&nbsp;</font><br>
<font size="2" color="#8D3970" face="Calibri"><b>CAUTION:</b></font><font size="2" color="#8D3970" face="Calibri">&nbsp;This e-mail originated outside the University of Southampton.
</font>
<p><font size="2" face="Arial">Hi out there</font><font size="3" face="Times New Roman"><br>
</font><font size="2" face="Arial"><br>
maybe stupid. maybe simple, maybe offtopic, maybe not: </font><font size="3" face="Times New Roman"><br>
</font><font size="2" face="Arial"><br>
We found out, that Server Side Includes (SSI) inside phrase dynamic.xml or templates will not be interpreted by cgi-scripts like cgi/stats/report.
<br>
Scenario: We generate static code, push it into a simple textfile.ssi and try to include it in the template with
</font><font size="3" face="Courier New">&nbsp;&lt;!--#include virtual=&quot;/maintenance.ssi&quot; --&gt;</font><font size="3" face="Times New Roman"><br>
</font><font size="2" face="Arial"><br>
So, in a nutshell: HowTo tell CGIs/Apache to use SSI after CGI has done? We thought, we tried out everything in Apache conf.<br>
Any hint is appreciated #-)<br>
<br>
Kind regards<br>
Jens</font><font size="3" face="Times New Roman"><br>
</font><font size="2" face="Arial"><br>
-- <br>
Jens Witzel<br>
Zentrale Informatik<br>
Universität Zürich<br>
Stampfenbachstrasse 73<br>
CH-8006 Zürich<br>
<br>
mail: &nbsp;</font><a href="mailto:jens.witzel@uzh.ch"><font size="2" color="#0000FF" face="Arial"><u>jens.witzel@uzh.ch</u></font></a><font size="2" face="Arial"><br>
phone: +41 44 63 56777</font><font size="2" color="#0000FF" face="Arial"><u><br>
</u></font><a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.zi.uzh.ch%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7Caca1a5ed3ec24706fcab08d911671285%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637559956647490484%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=pwyXzWYqUX6KZZwBqSVD7RNpLHd1eD3MTklwfjQ39wQ%3D&amp;reserved=0" originalSrc="http://www.zi.uzh.ch/" shash="mjOi9rsycYsNCHFDBQ3Z+lkXlZGv+HofbSJcd4gLgPWnQVYwQdMsgqKq4uDBSyJvJMT+UTubHD5qmCO2mLPMcZn+zCymnFtIuBZbLKqqNuiJHAFJctN0gludytwjLbZ52m5Ay+/Z/43hSWgO/zY4tU007dB46KYHX5ALmE2kYAs="><font size="2" color="#0000FF" face="Arial"><u>http://www.zi.uzh.ch</u></font></a>
</p>
<p></p>
<p></p>
</div>
</div>
</body>
</html>