]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/examples/apache/eg_vhost.conf.in
LP#1648234: fix Apache 2.2 version of redirect rules
[working/Evergreen.git] / Open-ILS / examples / apache / eg_vhost.conf.in
1 # ----------------------------------------------------------------------------------
2 # This is the global Evergreen virtual host config.  Anything you want published
3 # through all virtual hosts (port 80, port 443, etc.) should live in here.
4 # ----------------------------------------------------------------------------------
5
6 # Since Apache 2.2 doesn't set REQUEST_SCHEME, work around it
7 # by setting an environment variable, per
8 # http://stackoverflow.com/a/23177714
9 RewriteCond %{HTTPS} off
10 RewriteRule .* - [E=REQUEST_SCHEME:http]
11
12 RewriteCond %{HTTPS} on
13 RewriteRule .* - [E=REQUEST_SCHEME:https]
14
15 # ----------------------------------------------------------------------------------
16 # Point / to the opac - if you have a custom skin or locale, point at it here
17 # ----------------------------------------------------------------------------------
18 RewriteRule ^/$ %{ENV:REQUEST_SCHEME}://%{HTTP_HOST}/eg/opac/home [R=301,L]
19
20 # ----------------------------------------------------------------------------------
21 # Redirect staff to the correct URL if they forget to include the final /
22 # ----------------------------------------------------------------------------------
23 RewriteRule ^/eg/staff$ https://%{HTTP_HOST}/eg/staff/ [R=301,L]
24
25 # ----------------------------------------------------------------------------------
26 # Point / to the IP address redirector
27 # ----------------------------------------------------------------------------------
28 #<LocationMatch ^/$>
29 #    SetHandler perl-script
30 #    PerlHandler OpenILS::WWW::Redirect
31 #    Options +ExecCGI
32 #    PerlSendHeader On
33 #    #PerlSetVar OILSRedirectSkin "default"
34 #    # OILSRedirectDepth defaults to the depth of the branch that the OPAC was directed to
35 #    #PerlSetVar OILSRedirectDepth "0"
36 #    #PerlSetVar OILSRedirectLocale "en-US"
37 #    # Use the template-toolkit opac
38 #    #PerlSetVar OILSRedirectTpac "true"
39 #    allow from all
40 #</LocationMatch>
41
42
43 # ----------------------------------------------------------------------------------
44 # Assign a default locale to the accessible OPAC
45 # ----------------------------------------------------------------------------------
46 RewriteRule ^/opac/extras/slimpac/start.html$ %{ENV:REQUEST_SCHEME}://%{HTTP_HOST}/opac/en-US/extras/slimpac/start.html [R=301,L]
47 RewriteRule ^/opac/extras/slimpac/advanced.html$ %{ENV:REQUEST_SCHEME}://%{HTTP_HOST}/opac/en-US/extras/slimpac/advanced.html [R=301,L]
48
49 # ----------------------------------------------------------------------------------
50 # Configure the gateway and translator
51 # ----------------------------------------------------------------------------------
52 OSRFGatewayConfig @sysconfdir@/opensrf_core.xml
53 OSRFTranslatorConfig @sysconfdir@/opensrf_core.xml
54 # Translator memcache server.  Default is localhost
55 # OSRFTranslatorCacheServer 127.0.0.1:11211
56
57
58 # ----------------------------------------------------------------------------------
59 # Added content plugin
60 # ----------------------------------------------------------------------------------
61 <Location /opac/extras/ac/>
62     SetHandler perl-script
63     PerlHandler OpenILS::WWW::AddedContent
64     Options +ExecCGI
65     PerlSendHeader On
66     allow from all
67 </Location>
68
69 # Lock clearing cache down to STAFF_LOGIN
70 <Location /opac/extras/ac/clearcache/>
71     PerlAccessHandler OpenILS::WWW::AccessHandler
72     PerlSetVar OILSAccessHandlerPermission "STAFF_LOGIN"
73 </Location>
74
75 # Autosuggest for searches
76 <Location /opac/extras/autosuggest>
77     SetHandler perl-script
78     PerlHandler OpenILS::WWW::AutoSuggest
79     PerlSendHeader On
80     Allow from All
81 </Location>
82
83 # Flattener service
84 <Location /opac/extras/flattener>
85     SetHandler perl-script
86     PerlHandler OpenILS::WWW::FlatFielder
87     PerlSendHeader On
88     Allow from All
89 </Location>
90
91 # ----------------------------------------------------------------------------------
92 # Replace broken cover images with a transparent GIF by default
93 # ----------------------------------------------------------------------------------
94 RewriteEngine ON
95 RewriteRule ^/opac/extras/ac/jacket/(small|medium|large)/$ \
96     /opac/images/blank.png [P,L]
97
98 <Location /opac/extras/ac/jacket>
99         ErrorDocument 404 /opac/images/blank.png
100 </Location>
101
102 # Uncomment one or more of these to have a "no image" image other than the blank
103 # image above.
104
105 # Note: There are no default images provided for these, you will need to provide
106 # your own "no image" image(s).
107
108 #<Location /opac/extras/ac/jacket/small>
109 #        ErrorDocument 404 /opac/images/noimage_small.png
110 #</Location>
111
112 #<Location /opac/extras/ac/jacket/medium>
113 #        ErrorDocument 404 /opac/images/noimage_medium.png
114 #</Location>
115
116 #<Location /opac/extras/ac/jacket/large>
117 #        ErrorDocument 404 /opac/images/noimage_large.png
118 #</Location>
119
120 # ----------------------------------------------------------------------------------
121 # Add the row ID (RID) and date so we can make unAPI happy
122 # ----------------------------------------------------------------------------------
123 RewriteCond %{QUERY_STRING} (^r|&r)=(\d+)
124 RewriteRule . - [E=OILS_OPAC_RID:%2,E=OILS_TIME_YEAR:%{TIME_YEAR}]
125
126 # ----------------------------------------------------------------------------------
127 # Pull the locale from the URL
128 # ----------------------------------------------------------------------------------
129 RewriteCond %{REQUEST_URI} ^/opac/(.*?)/
130 RewriteRule . - [E=locale:%1]
131
132 # ----------------------------------------------------------------------------------
133 # Rewrite JSPac->TPac with redirects
134 # ----------------------------------------------------------------------------------
135
136 # First things first, extract useful data
137 # And we are going to start with a "this is the JSPac" check on each of these:
138 # RewriteCond %{REQUEST_URI} ^/?opac/
139
140 # Basic (overall) search type, if present
141 # I am cheating and grabbing RT or TP because I dunno the difference between them.
142 RewriteCond %{REQUEST_URI} ^/opac/
143 RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])(rt|tp)=([^;&]*)
144 RewriteRule . - [E=OILS_JSPAC_SEARCH_TYPE:qtype=%3;]
145
146 # Basic (overall) search term(s), if present - NOTE: Not doing advanced search.
147 RewriteCond %{REQUEST_URI} ^/opac/
148 RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])t=([^;&]*)
149 RewriteRule . - [E=OILS_JSPAC_SEARCH_TERMS:query=%2;]
150
151 # Search Location, if present
152 RewriteCond %{REQUEST_URI} ^/opac/
153 RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])l=([^;&]*)
154 RewriteRule . - [E=OILS_JSPAC_SEARCH_LOCATION:locg=%2;]
155
156 # My Account
157 RewriteRule /opac/[^/]*/skin/default/xml/myopac.xml /eg/opac/myopac/main?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L]
158
159 # Record Pages
160 # /opac/en-US/skin/default/xml/rdetail.xml?r=32 -> /eg/opac/record/32
161 RewriteCond %{QUERY_STRING} (^|[^0-9a-zA-Z])r=([^;&]*)
162 RewriteRule /opac/.*/rdetail.xml /eg/opac/record/%2?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L]
163
164 # Bookbag Pages
165 # /opac/extras/feed/bookbag/html-full/1 -> /eg/opac/results?bookbag=1;page=0;locg=1;depth=0
166 RewriteRule /opac/extras/feed/bookbag/html-full/(\d*) /eg/opac/results?bookbag=$1;%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L]
167
168 # Search Results Pages
169 RewriteRule /opac/[^/]*/skin/[^/]*/xml/rresult.xml /eg/opac/results?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L]
170
171 # Basic Search (STILL not doing advanced)
172 # Fallback! But only for things that end in xml, htm, or html
173 # Images, CSS, etc can stick around.
174 RewriteRule /opac/[^/]*/skin/.*(xml|htm|html|/)$ /eg/opac/home?%{ENV:OILS_JSPAC_SEARCH_TYPE}%{ENV:OILS_JSPAC_SEARCH_TERMS}%{ENV:OILS_JSPAC_SEARCH_LOCATION} [NE,R,L]
175
176 # -----------------------------------------------------------------------------$
177 # Force HTTPS for /eg/circ/selfcheck
178 # -----------------------------------------------------------------------------$
179 RewriteCond %{HTTPS} off
180 RewriteRule ^(/eg/circ/selfcheck) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]
181
182 # ----------------------------------------------------------------------------------
183 # For sanity reasons, default indexes to Off
184 # ----------------------------------------------------------------------------------
185 Options -Indexes
186
187 # ----------------------------------------------------------------------------------
188 # Configure the OPAC
189 # ----------------------------------------------------------------------------------
190 <LocationMatch /opac/>
191     AddType application/xhtml+xml .xml
192    
193     # - configure mod_xmlent
194     XMLEntStripPI "yes"
195     XMLEntEscapeScript "no"
196     XMLEntStripComments "yes"
197     XMLEntContentType "text/html; charset=utf-8"
198     # forces quirks mode which we want for now
199     XMLEntStripDoctype "yes" 
200
201     # - set up the include handlers
202     Options +Includes
203     AddOutputFilter INCLUDES .xsl
204     AddOutputFilter INCLUDES;XMLENT .xml
205                     
206     SetEnvIf Request_URI ".*" OILS_OPAC_BASE=/opac/
207     
208     # This gives you the option to configure a different host to serve OPAC images from
209     # Specify the hostname (without protocol) and path to the images.  Protocol will
210     # be determined at runtime
211     #SetEnvIf Request_URI ".*" OILS_OPAC_IMAGES_HOST=static.example.org/opac/
212
213     # In addition to loading images from a static host, you can also load CSS and/or
214     # Javascript from a static host or hosts. Protocol will be determined at runtime
215     # and/or by configuration options immediately following.
216     #SetEnvIf Request_URI ".*" OILS_OPAC_CSS_HOST=static.example.org/opac/
217     #SetEnvIf Request_URI ".*" OILS_OPAC_JS_HOST=static.example.org/opac/
218
219     # If you are not able to serve static content via https and 
220     # wish to force http:// (and are comfortable with mixed-content
221     # warnings in client browsers), set this:
222     #SetEnvIf Request_URI ".*" OILS_OPAC_STATIC_PROTOCOL=http
223
224     # If you would prefer to fall back to your non-static servers for 
225     # https pages, avoiding mixed-content warnings in client browsers
226     # and are willing to accept some increased server load, set this:
227     #SetEnvIf Request_URI ".*" OILS_OPAC_BYPASS_STATIC_FOR_HTTPS=yes
228
229     # Specify a ChiliFresh account to integrate their services with the OPAC
230     #SetEnv OILS_CHILIFRESH_ACCOUNT
231     #SetEnv OILS_CHILIFRESH_PROFILE
232     #SetEnv OILS_CHILIFRESH_URL http://chilifresh.com/on-site/js/evergreen.js
233     #SetEnv OILS_CHILIFRESH_HTTPS_URL https://secure.chilifresh.com/on-site/js/evergreen.js
234
235     # Specify the initial script URL for Novelist (containing account credentials, etc.)
236     #SetEnv OILS_NOVELIST_URL
237     #
238
239     # Uncomment to force SSL any time a patron is logged in.  This protects 
240     # authentication tokens.  Left commented out for backwards compat for now.
241     #SetEnv OILS_OPAC_FORCE_LOGIN_SSL 1
242
243     # If set, the skin uses the combined JS file at $SKINDIR/js/combined.js
244     #SetEnv OILS_OPAC_COMBINED_JS 1
245
246 </LocationMatch>
247
248 <Location /opac/>
249     # ----------------------------------------------------------------------------------
250     # Some mod_deflate fun
251     # ----------------------------------------------------------------------------------
252     <IfModule mod_deflate.c>
253         SetOutputFilter DEFLATE
254
255         BrowserMatch ^Mozilla/4 gzip-only-text/html
256         BrowserMatch ^Mozilla/4\.0[678] no-gzip
257         BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
258
259         SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
260
261         <IfModule mod_headers.c>
262             Header append Vary User-Agent env=!dont-vary
263         </IfModule>
264     </IfModule>
265
266 </Location>
267
268 <Location //opac/>
269     # ----------------------------------------------------------------------------------
270     # Some mod_deflate fun
271     # ----------------------------------------------------------------------------------
272     <IfModule mod_deflate.c>
273         SetOutputFilter DEFLATE
274
275         BrowserMatch ^Mozilla/4 gzip-only-text/html
276         BrowserMatch ^Mozilla/4\.0[678] no-gzip
277         BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
278
279         SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
280
281         <IfModule mod_headers.c>
282             Header append Vary User-Agent env=!dont-vary
283         </IfModule>
284     </IfModule>
285
286 </Location>
287
288 # ----------------------------------------------------------------------------------
289 # Force SSL on the OPAC's "My Account" page
290 # ----------------------------------------------------------------------------------
291 <LocationMatch .*/myopac.xml>
292     SSLRequireSSL
293 </LocationMatch>
294
295 RewriteCond %{QUERY_STRING} locale=([^&]*)
296 RewriteRule ^/opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/(.*)$ %{ENV:REQUEST_SCHEME}://%{HTTP_HOST}/opac/%1/extras/slimpac/$1? [redirect]
297 <LocationMatch /opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/>
298     AddOutputFilter INCLUDES;XMLENT .html
299 </LocationMatch>
300
301 # ----------------------------------------------------------------------------------
302 # Run server-side XUL and XHTML through xmlent to load the correct XML entities
303 # ----------------------------------------------------------------------------------
304 RewriteCond %{HTTP:Accept-Language} ^([a-z]{2}-[A-Z]{2})$
305 # Default to en-US if we haven't matched a locale of the form xx-YY 
306 RewriteRule .? - [S=4]
307 RewriteRule ^/xul/      -       [E=locale:en-US]
308 RewriteRule ^/reports/  -       [E=locale:en-US]
309 RewriteRule .? - [E=locale:en-US]
310 RewriteRule .? - [S=3]
311 # Otherwise, set our real locale
312 RewriteRule ^/xul/      -       [E=locale:%{HTTP:Accept-Language}]
313 RewriteRule ^/reports/  -       [E=locale:%{HTTP:Accept-Language}]
314 RewriteRule .? - [E=locale:%{HTTP:Accept-Language}]
315
316 <LocationMatch /xul/.*\.x?html$>
317     Options +Includes
318     XMLEntEscapeScript "no"
319     XMLEntStripComments "yes"
320     XMLEntStripPI "yes"
321     XMLEntStripDoctype "yes"
322     XMLEntContentType "text/html; charset=utf-8"
323     AddOutputFilter INCLUDES;XMLENT .xhtml
324     AddOutputFilter INCLUDES;XMLENT .html
325     SetEnv no-gzip
326     allow from all
327 </LocationMatch>
328
329
330 <LocationMatch /xul/.*\.xul$>
331     Options +Includes
332     XMLEntContentType "application/vnd.mozilla.xul+xml"
333     AddOutputFilter INCLUDES;XMLENT .xul
334     SetEnv no-gzip
335     allow from all
336 </LocationMatch>
337
338 # ----------------------------------------------------------------------------------
339 # Supercat feeds
340 # ----------------------------------------------------------------------------------
341 <Location /opac/extras/oisbn>
342     SetHandler perl-script
343     PerlHandler OpenILS::WWW::SuperCat::oisbn
344     Options +ExecCGI
345     PerlSendHeader On
346     allow from all
347 </Location>
348 <Location /opac/extras/supercat>
349     SetHandler perl-script
350     PerlHandler OpenILS::WWW::SuperCat::supercat
351     Options +ExecCGI
352     PerlSendHeader On
353     allow from all
354 </Location>
355 <Location /opac/extras/unapi>
356     SetHandler perl-script
357     PerlHandler OpenILS::WWW::SuperCat::unapi
358     Options +ExecCGI
359     PerlSendHeader On
360     allow from all
361 </Location>
362 <Location /opac/extras/feed/bookbag>
363     SetHandler perl-script
364     PerlHandler OpenILS::WWW::SuperCat::bookbag_feed
365     Options +ExecCGI
366     PerlSendHeader On
367     allow from all
368 </Location>
369 <Location /opac/extras/opensearch>
370     SetHandler perl-script
371     PerlHandler OpenILS::WWW::SuperCat::opensearch_feed
372     Options +ExecCGI
373     PerlSendHeader On
374     allow from all
375 </Location>
376 <Location /opac/extras/sru>
377     SetHandler perl-script
378     PerlHandler OpenILS::WWW::SuperCat::sru_search
379     Options +ExecCGI
380     PerlSendHeader On
381     allow from all
382 </Location>
383 <Location /opac/extras/sru_auth>
384     SetHandler perl-script
385     PerlHandler OpenILS::WWW::SuperCat::sru_auth_search
386     Options +ExecCGI
387     PerlSendHeader On
388     allow from all
389 </Location>
390 <Location /opac/extras/feed/freshmeat>
391     SetHandler perl-script
392     PerlHandler OpenILS::WWW::SuperCat::changes_feed
393     Options +ExecCGI
394     PerlSendHeader On
395     allow from all
396 </Location>
397 <Location /opac/extras/browse>
398     SetHandler perl-script
399     PerlHandler OpenILS::WWW::SuperCat::string_browse
400     Options +ExecCGI
401     PerlSendHeader On
402     allow from all
403 </Location>     
404 <Location /opac/extras/startwith>
405     SetHandler perl-script
406     PerlHandler OpenILS::WWW::SuperCat::string_startwith
407     Options +ExecCGI
408     PerlSendHeader On
409     allow from all
410 </Location>     
411         
412 # ----------------------------------------------------------------------------------
413 # Module for displaying OpenSRF API documentation
414 # ----------------------------------------------------------------------------------
415 <Location /opac/extras/docgen.xsl>
416     AddOutputFilter INCLUDES .xsl
417 </Location>
418
419 # ----------------------------------------------------------------------------------
420 # Module for processing staff-client offline scripts lives here
421 # ----------------------------------------------------------------------------------
422 <Directory "@localstatedir@/cgi-bin/offline">
423     AddHandler cgi-script .pl
424     AllowOverride None
425     Options +ExecCGI
426     allow from all
427 </Directory>
428         
429         
430 # ----------------------------------------------------------------------------------
431 # XXX Note, it's important to explicitly set the JSON encoding style 
432 # (OSRFGatewayLegacyJSON), since the default encoding style will likely change 
433 # with OpenSRF 1.0
434 # ----------------------------------------------------------------------------------
435 # OpenSRF JSON legacy gateway
436 # ----------------------------------------------------------------------------------
437 <Location /gateway>
438     SetHandler osrf_json_gateway_module
439     OSRFGatewayLegacyJSON "true"
440     allow from all
441 </Location>
442 # ----------------------------------------------------------------------------------
443 # New-style OpenSRF JSON gateway
444 # ----------------------------------------------------------------------------------
445 <Location /osrf-gateway-v1>
446     SetHandler osrf_json_gateway_module
447     OSRFGatewayLegacyJSON "false"
448     allow from all
449 </Location>
450
451 # ----------------------------------------------------------------------------------
452 # OpenSRF-over-HTTP translator
453 # (http://open-ils.org/dokuwiki/doku.php?id=opensrf_over_http)
454 # ----------------------------------------------------------------------------------
455 <Location /osrf-http-translator>
456     SetHandler osrf_http_translator_module
457     allow from all
458 </Location>
459
460 # ----------------------------------------------------------------------------------
461 # The exporter lives here
462 # ----------------------------------------------------------------------------------
463 <Location /exporter>
464     SetHandler perl-script
465     AuthType Basic
466     AuthName "Exporter Login"
467     PerlOptions +GlobalRequest
468     PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
469     PerlAuthenHandler OpenILS::WWW::Proxy::Authen
470     require valid-user
471     PerlHandler OpenILS::WWW::Exporter
472     Options +ExecCGI
473     PerlSendHeader On
474     allow from all
475 </Location>
476
477 <Location /opac/extras/merge_template>
478     SetHandler perl-script
479     AuthType Basic
480     AuthName "Batch Update Login"
481     PerlOptions +GlobalRequest
482     PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
483     PerlAuthenHandler OpenILS::WWW::Proxy::Authen
484     require valid-user
485     PerlHandler OpenILS::WWW::TemplateBatchBibUpdate
486     PerlSendHeader On
487     Options +ExecCGI
488     allow from all
489 </Location>
490
491 <Location /opac/extras/circ>
492     AuthType Basic
493     AuthName "Circ Extras Login"
494     PerlOptions +GlobalRequest
495     PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
496     PerlAuthenHandler OpenILS::WWW::Proxy::Authen
497     require valid-user
498     Options +ExecCGI
499     PerlSendHeader On
500     allow from all
501 </Location>
502
503 <Location /collections>
504     SetHandler perl-script
505     AuthType Basic
506     AuthName "Collections Login"
507     PerlOptions +GlobalRequest
508     PerlSetVar OILSProxyPermissions "money.collections_tracker.create"
509     PerlAuthenHandler OpenILS::WWW::Proxy::Authen
510     require valid-user
511     Options +ExecCGI
512     PerlSendHeader On
513     allow from all
514 </Location>
515
516 # ----------------------------------------------------------------------------------
517 # Protect Standalone/Offline mode files from public view
518 # ----------------------------------------------------------------------------------
519 <Location /standalone/>
520     AuthType Basic
521     AuthName "Standalone Mode Login"
522     PerlOptions +GlobalRequest
523     PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
524     PerlAuthenHandler OpenILS::WWW::Proxy::Authen
525     require valid-user
526     PerlSendHeader On
527     allow from all
528     SSLRequireSSL
529 </Location>
530
531 # ----------------------------------------------------------------------------------
532 # Reporting output lives here
533 # ----------------------------------------------------------------------------------
534 <Location /reporter/>
535     AuthType Basic
536     AuthName "Report Login"
537     PerlOptions +GlobalRequest
538     PerlSetVar OILSProxyPermissions "VIEW_REPORT_OUTPUT"
539     PerlAuthenHandler OpenILS::WWW::Proxy::Authen
540     require valid-user
541     Options +ExecCGI
542     PerlSendHeader On
543     allow from all
544 </Location>
545
546 # ----------------------------------------------------------------------------------
547 # Reports GUI
548 # ----------------------------------------------------------------------------------
549 <LocationMatch /reports.*\.x?html>
550     Options +Includes
551     XMLEntContentType "text/html; charset=utf-8"
552     AddOutputFilter INCLUDES;XMLENT .xhtml
553     AddOutputFilter INCLUDES;XMLENT .html
554 </LocationMatch>
555
556 <LocationMatch /reports>
557     Options +Includes
558     AddOutputFilter INCLUDES;XMLENT .xhtml
559 </LocationMatch>
560
561 # capture locale CGI param for /reports/fm_IDL.xml
562 RewriteCond %{REQUEST_URI} ^/reports/fm_IDL.xml
563 RewriteCond %{QUERY_STRING} locale=([^&;]*)
564 RewriteRule . - [E=locale:%1]
565
566 <LocationMatch /reports/fm_IDL.xml>
567     IDLChunkStripPI "yes"
568     IDLChunkEscapeScript "no"
569     IDLChunkStripComments "yes"
570     IDLChunkStripDoctype "yes"
571     IDLChunkContentType "application/xml; charset=utf-8"
572     AddOutputFilter INCLUDES;IDLCHUNK .xml
573     SetEnv no-gzip
574 </LocationMatch>
575
576 # ----------------------------------------------------------------------------------
577 # EDI Message viewer
578 # ----------------------------------------------------------------------------------
579 <Location /edi>
580     SetHandler perl-script
581     PerlHandler OpenILS::WWW::EDI
582     Options +ExecCGI
583     PerlSendHeader On
584     allow from all
585 </Location>     
586
587 # ----------------------------------------------------------------------------------
588 # XML-RPC gateway
589 # ----------------------------------------------------------------------------------
590 <Location /xml-rpc>
591     SetHandler perl-script
592     PerlHandler OpenILS::WWW::XMLRPCGateway
593     Options +ExecCGI
594     PerlSendHeader On
595     allow from all
596     <IfModule mod_headers.c>
597         Header onsuccess set Cache-Control no-cache
598     </IfModule>
599 </Location>
600
601 # ----------------------------------------------------------------------------------
602 # Conify - next-generation Evergreen administration interface
603 # ----------------------------------------------------------------------------------
604 RewriteRule ^/conify/([a-z]{2}-[A-Z]{2})/global/(.*)$ /conify/global/$2 [E=locale:$1,L]
605 <Location /conify>
606     Options +Includes
607     XMLEntStripPI "yes"
608     XMLEntEscapeScript "no"
609     XMLEntStripComments "no"
610     XMLEntContentType "text/html; charset=utf-8"
611     AddOutputFilter INCLUDES;XMLENT .html
612  
613     AuthType Basic
614     AuthName "Dojo Admin Login"
615     PerlOptions +GlobalRequest
616     PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
617     PerlAuthenHandler OpenILS::WWW::Proxy::Authen
618     require valid-user
619     Options +ExecCGI
620     PerlSendHeader On
621     allow from all
622 </Location>
623
624 # ----------------------------------------------------------------------------------
625 # The PhoneList lives here
626 # ----------------------------------------------------------------------------------
627 <Location /phonelist>
628     SetHandler perl-script
629     AuthType Basic
630     AuthName "PhoneList Login"
631     require valid-user
632     PerlOptions +GlobalRequest
633     PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
634     PerlHandler OpenILS::WWW::PhoneList
635     PerlAuthenHandler OpenILS::WWW::Proxy::Authen
636     Options +ExecCGI
637     PerlSendHeader On
638     allow from all
639     <IfModule mod_headers.c>
640         Header onsuccess set Cache-Control no-cache
641     </IfModule>
642 </Location>
643 <Location /vandelay-upload>
644     SetHandler perl-script
645     PerlHandler OpenILS::WWW::Vandelay::spool_marc
646     Options +ExecCGI
647     allow from all
648 </Location>
649
650 # OpenURL 0.1 searching based on OpenSearch
651 RewriteMap openurl prg:@bindir@/openurl_map.pl
652 RewriteCond %{QUERY_STRING} (^.*$)
653 RewriteRule ^/openurl$ ${openurl:%1} [NE,PT]
654
655
656
657 # General Evergreen web template processor
658 <Location /eg>
659     SetHandler perl-script
660     PerlHandler OpenILS::WWW::EGWeb
661     Options +ExecCGI
662     PerlSendHeader On
663     allow from all
664
665     PerlSetVar OILSWebBasePath "/eg"
666     PerlSetVar OILSWebWebDir "@localstatedir@/web"
667     PerlSetVar OILSWebDefaultTemplateExtension "tt2"
668
669     # Enable Template-Toolkit error debugging messages (apache error log)
670     PerlSetVar OILSWebDebugTemplate "false"
671     # local cache of compiled Template Toolkit templates
672     PerlSetVar OILSWebCompiledTemplateCache "/tmp/eg_template_cache"
673     # template TTL - how long, in seconds, that Template Toolkit
674     # waits to check for updated template files
675     #PerlSetVar OILSWebTemplateStatTTL 60
676
677     # -------------------------------------------------------
678     # Media Prefix.  In the 3rd example, the protocol (http) is enforced
679     #PerlSetVar OILSWebMediaPrefix "/media"
680     #PerlSetVar OILSWebMediaPrefix "static.example.com/media"
681     #PerlSetVar OILSWebMediaPrefix "http://static.example.com/media"
682
683     # Locale messages files:
684     #
685     # These appear in pairs; the first represents the user agent
686     # Accept-Language header locale, and the second represents
687     # the fully-qualified path for the corresponding PO file that
688     # contains the messages.
689     #
690     # If you enable two or more locales, then users will be able to
691     # select their preferred locale from a locale picker in the TPAC.
692     #
693     #PerlAddVar OILSWebLocale "en"
694     #PerlAddVar OILSWebLocale "@localstatedir@/data/locale/opac/messages.en.po"
695     #PerlAddVar OILSWebLocale "en_ca"
696     #PerlAddVar OILSWebLocale "@localstatedir@/data/locale/opac/en-CA.po"
697     #PerlAddVar OILSWebLocale "fr_ca"
698     #PerlAddVar OILSWebLocale "@localstatedir@/data/locale/opac/fr-CA.po"
699
700     # Set the default locale: defaults to en-US
701     #PerlAddVar OILSWebDefaultLocale "fr_ca"
702     
703     # Templates will be loaded from the following paths in reverse order.
704     PerlAddVar OILSWebTemplatePath "@localstatedir@/templates"
705     #PerlAddVar OILSWebTemplatePath "@localstatedir@/templates_localskin"
706
707     #-------------------------------------------------
708     # Added Content Configuration
709     #-------------------------------------------------
710     # Content Cafe
711     #SetEnv OILS_CONTENT_CAFE_USER MYUSER
712     #SetEnv OILS_CONTENT_CAFE_PASS MYPASS
713     
714     # LibraryThing
715     #SetEnv OILS_LIBRARYTHING_URL http://ltfl.librarything.com/forlibraries/widget.js?id=MYID
716     #SetEnv OILS_LIBRARYTHING_HTTPS_URL https://ltfl.librarything.com/forlibraries/widget.js?id=MYID
717     
718     # ChiliFresh
719     #SetEnv OILS_CHILIFRESH_ACCOUNT
720     #SetEnv OILS_CHILIFRESH_URL http://chilifresh.com/on-site/js/evergreen.js
721     #SetEnv OILS_CHILIFRESH_HTTPS_URL https://secure.chilifresh.com/on-site/js/evergreen.js
722     #-------------------------------------------------
723
724     <IfModule mod_deflate.c>
725         SetOutputFilter DEFLATE
726         BrowserMatch ^Mozilla/4 gzip-only-text/html
727         BrowserMatch ^Mozilla/4\.0[678] no-gzip
728         BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
729         SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
730         <IfModule mod_headers.c>
731             Header append Cache-Control "public"
732             Header append Vary User-Agent env=!dont-vary
733         </IfModule>
734     </IfModule>
735 </Location>
736 <LocationMatch ^/(images|css|js)/>
737     # should pick up the default expire time from eg.conf...
738     <IfModule mod_deflate.c>
739         SetOutputFilter DEFLATE
740         BrowserMatch ^Mozilla/4 gzip-only-text/html
741         BrowserMatch ^Mozilla/4\.0[678] no-gzip
742         BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
743         SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
744         <IfModule mod_headers.c>
745             Header append Cache-Control "public"
746             Header append Vary User-Agent env=!dont-vary
747         </IfModule>
748     </IfModule>
749 </LocationMatch>
750 <Location /eg/opac>
751     PerlSetVar OILSWebContextLoader "OpenILS::WWW::EGCatLoader"
752     # Expire the HTML quickly since we're loading dynamic data for each page
753     ExpiresActive On
754     ExpiresByType text/html "access plus 5 seconds"
755 </Location>
756 <Location /eg/kpac>
757     PerlSetVar OILSWebContextLoader "OpenILS::WWW::EGKPacLoader"
758     PerlSetVar KPacConfigFile "@sysconfdir@/kpac.xml.example"
759     ExpiresActive On
760     ExpiresByType text/html "access plus 5 seconds"
761 </Location>
762
763 # Note: the template processor will decline handling anything it does not
764 # have an explicit configuration for, which means it will fall back to 
765 # Apache to serve the file.  However, in the interest of speed, go ahead 
766 # and tell Apache to avoid asking OpenILS::WWW::EGWeb for static content.
767 # Add more exemptions as needed.
768 <LocationMatch ^/eg/.*(\.js|\.html|\.xhtml|\.xml|\.jpg|\.png|\.gif)$>
769     SetHandler None
770 </LocationMatch>
771
772 # ----------------------------------------------------------------------------------
773 # Some mod_deflate setup
774 # ----------------------------------------------------------------------------------
775 <IfModule mod_deflate.c>
776     ## optional logging for mod_deflate debugging
777     ##DeflateFilterNote Input instream
778     ##DeflateFilterNote Output outstream
779     ##DeflateFilterNote Ratio ratio
780     ##
781     ##LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
782     ##CustomLog /var/log/apache2/deflate_log deflate
783
784     # There are problems with XMLENT and mod_deflate - so lets disable it
785     # This is where we don't have a pre-existing LocationMatch directive earlier
786     <LocationMatch /opac/.*\.xml$>
787         SetEnv no-gzip
788     </LocationMatch>
789     <LocationMatch /opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/.*\.html$>
790         SetEnv no-gzip
791     </LocationMatch>
792     <LocationMatch /reports/.*\.xhtml$>
793         SetEnv no-gzip
794     </LocationMatch>
795     <LocationMatch /conify/.*\.html$>
796         SetEnv no-gzip
797     </LocationMatch>
798 </IfModule>
799
800
801 <Location /IDL2js>
802
803     SetHandler perl-script
804     PerlHandler OpenILS::WWW::IDL2js
805     Options +ExecCGI
806     PerlSendHeader On
807     allow from all
808
809     <IfModule mod_headers.c>
810         Header append Cache-Control "public"
811     </IFModule>
812
813     <IfModule mod_deflate.c>
814         SetOutputFilter DEFLATE
815         BrowserMatch ^Mozilla/4 gzip-only-text/html
816         BrowserMatch ^Mozilla/4\.0[678] no-gzip
817         BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
818         SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
819         <IfModule mod_headers.c>
820             Header append Vary User-Agent env=!dont-vary
821         </IfModule>
822     </IfModule>
823 </Location>
824
825 <LocationMatch /eg/staff/>
826     SSLRequireSSL
827     Options -MultiViews
828     PerlSetVar OILSWebStopAtIndex "true"
829
830     RewriteCond %{HTTPS} off
831     RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R,L]
832
833     # sample staff-specific translation files
834     #PerlAddVar OILSWebLocale "en_ca"
835     #PerlAddVar OILSWebLocale "@localstatedir@/data/locale/staff/en-CA.po"
836     #PerlAddVar OILSWebLocale "fr_ca"
837     #PerlAddVar OILSWebLocale "@localstatedir@/data/locale/staff/fr-CA.po"
838 </LocationMatch>
839
840 <Location /js/>
841     <IfModule mod_headers.c>
842         Header append Cache-Control "public"
843     </IFModule>
844     <IfModule mod_deflate.c>
845         SetOutputFilter DEFLATE
846         BrowserMatch ^Mozilla/4 gzip-only-text/html
847         BrowserMatch ^Mozilla/4\.0[678] no-gzip
848         BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
849         SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
850         <IfModule mod_headers.c>
851             Header append Vary User-Agent env=!dont-vary
852         </IfModule>
853     </IfModule>
854 </Location>
855
856 # Uncomment the following to force SSL for everything. Note that this defeats caching
857 # and you will suffer a performance hit.
858 #RewriteCond %{HTTPS} off
859 #RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R,L]