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