]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/examples/apache/eg_vhost.conf
Beginning of modperl EDI message viewer
[working/Evergreen.git] / Open-ILS / examples / apache / eg_vhost.conf
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 ^/$ /opac/en-US/skin/default/xml/index.xml
10
11 # ----------------------------------------------------------------------------------
12 # Point / to the IP address redirector
13 # ----------------------------------------------------------------------------------
14 #<LocationMatch ^/$>
15 #    SetHandler perl-script
16 #    PerlHandler OpenILS::WWW::Redirect
17 #    Options +ExecCGI
18 #    PerlSendHeader On
19 #    #PerlSetVar OILSRedirectSkin "default"
20 #    # OILSRedirectDepth defaults to the depth of the branch that the OPAC was directed to
21 #    #PerlSetVar OILSRedirectDepth "0"
22 #    #PerlSetVar OILSRedirectLocale "en-US"
23 #    allow from all
24 #</LocationMatch>
25
26
27 # ----------------------------------------------------------------------------------
28 # Assign a default locale to the accessible OPAC
29 # ----------------------------------------------------------------------------------
30 RedirectMatch 301 ^/opac/extras/slimpac/start.html$    /opac/en-US/extras/slimpac/start.html
31 RedirectMatch 301 ^/opac/extras/slimpac/advanced.html$ /opac/en-US/extras/slimpac/advanced.html
32
33 # ----------------------------------------------------------------------------------
34 # Configure the gateway
35 # ----------------------------------------------------------------------------------
36 OSRFGatewayConfig /openils/conf/opensrf_core.xml
37 # Translator memcache server.  Default is localhost
38 # OSRFTranslatorCacheServer 127.0.0.1:11211
39
40
41 # ----------------------------------------------------------------------------------
42 # Added content plugin
43 # ----------------------------------------------------------------------------------
44 <Location /opac/extras/ac/>
45     SetHandler perl-script
46     PerlHandler OpenILS::WWW::AddedContent
47     Options +ExecCGI
48     PerlSendHeader On
49     allow from all
50 </Location>
51
52 # ----------------------------------------------------------------------------------
53 # Replace broken cover images with a transparent GIF by default
54 # ----------------------------------------------------------------------------------
55 RewriteEngine ON
56 RewriteRule ^/opac/extras/ac/jacket/(small|medium|large)/$ \
57     /opac/images/blank.png [P,L]
58
59 # ----------------------------------------------------------------------------------
60 # Add the row ID (RID) and date so we can make unAPI happy
61 # ----------------------------------------------------------------------------------
62 RewriteEngine ON
63 RewriteCond %{QUERY_STRING} (^r|&r)=(\d+)
64 RewriteRule - - [E=OILS_OPAC_RID:%2]
65 RewriteRule - - [E=OILS_TIME_YEAR:%{TIME_YEAR}] [L]
66
67 # ----------------------------------------------------------------------------------
68 # Pull the locale from the URL
69 # ----------------------------------------------------------------------------------
70 RewriteEngine ON
71 RewriteCond %{REQUEST_URI} ^/opac/(.*?)/
72 RewriteRule - - [E=locale:%1] [L]
73
74 # ----------------------------------------------------------------------------------
75 # Configure the OPAC
76 # ----------------------------------------------------------------------------------
77 <LocationMatch /opac/>
78     AddType application/xhtml+xml .xml
79    
80     # - configure mod_xmlent
81     XMLEntStripPI "yes"
82     XMLEntEscapeScript "no"
83     XMLEntStripComments "yes"
84     XMLEntContentType "text/html; charset=utf-8"
85     # forces quirks mode which we want for now
86     XMLEntStripDoctype "yes" 
87
88     # - set up the include handlers
89     Options +Includes
90     AddOutputFilter INCLUDES .xsl
91     AddOutputFilter INCLUDES;XMLENT .xml
92                     
93     SetEnvIf Request_URI ".*" OILS_OPAC_BASE=/opac/
94     
95     # This gives you the option to configure a different host to serve OPAC images from
96     # Specify the hostname (without protocol) and path to the images.  Protocol will
97     # be determined at runtime
98     #SetEnvIf Request_URI ".*" OILS_OPAC_IMAGES_HOST=static.example.org/opac/
99
100     # In addition to loading images from a static host, you can also load CSS and/or
101     # Javascript from a static host or hosts. Protocol will be determined at runtime
102     # and/or by configuration options immediately following.
103     #SetEnvIf Request_URI ".*" OILS_OPAC_CSS_HOST=static.example.org/opac/
104     #SetEnvIf Request_URI ".*" OILS_OPAC_JS_HOST=static.example.org/opac/
105
106     # If you are not able to serve static content via https and 
107     # wish to force http:// (and are comfortable with mixed-content
108     # warnings in client browsers), set this:
109     #SetEnvIf Request_URI ".*" OILS_OPAC_STATIC_PROTOCOL=http
110
111     # If you would prefer to fall back to your non-static servers for 
112     # https pages, avoiding mixed-content warnings in client browsers
113     # and are willing to accept some increased server load, set this:
114     #SetEnvIf Request_URI ".*" OILS_OPAC_BYPASS_STATIC_FOR_HTTPS=yes
115
116     # Specify a ChiliFresh account to integrate their services with the OPAC
117     #SetEnv OILS_CHILIFRESH_ACCOUNT
118     #SetEnv OILS_CHILIFRESH_PROFILE
119     #SetEnv OILS_CHILIFRESH_URL http://chilifresh.com/on-site/js/evergreen.js
120
121     # Specify the initial script URL for Novelist (containing account credentials, etc.)
122     #SetEnv OILS_NOVELIST_URL
123     
124
125     # Uncomment to force SSL any time a patron is logged in.  This protects 
126     # authentication tokens.  Left commented out for backwards compat for now.
127     #SetEnv OILS_OPAC_FORCE_LOGIN_SSL 1
128
129 </LocationMatch>
130
131 <Location /opac/>
132     # ----------------------------------------------------------------------------------
133     # Some mod_deflate fun
134     # ----------------------------------------------------------------------------------
135     <IfModule mod_deflate.c>
136         SetOutputFilter DEFLATE
137
138         BrowserMatch ^Mozilla/4 gzip-only-text/html
139         BrowserMatch ^Mozilla/4\.0[678] no-gzip
140         BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
141
142         SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
143
144         <IfModule mod_headers.c>
145             Header append Vary User-Agent env=!dont-vary
146         </IfModule>
147     </IfModule>
148
149 </Location>
150
151 <Location //opac/>
152     # ----------------------------------------------------------------------------------
153     # Some mod_deflate fun
154     # ----------------------------------------------------------------------------------
155     <IfModule mod_deflate.c>
156         SetOutputFilter DEFLATE
157
158         BrowserMatch ^Mozilla/4 gzip-only-text/html
159         BrowserMatch ^Mozilla/4\.0[678] no-gzip
160         BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
161
162         SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
163
164         <IfModule mod_headers.c>
165             Header append Vary User-Agent env=!dont-vary
166         </IfModule>
167     </IfModule>
168
169 </Location>
170
171 <Location /js/>
172     # ----------------------------------------------------------------------------------
173     # Some mod_deflate fun
174     # ----------------------------------------------------------------------------------
175     <IfModule mod_deflate.c>
176         SetOutputFilter DEFLATE
177
178         BrowserMatch ^Mozilla/4 gzip-only-text/html
179         BrowserMatch ^Mozilla/4\.0[678] no-gzip
180         BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
181
182         SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
183
184         <IfModule mod_headers.c>
185             Header append Vary User-Agent env=!dont-vary
186         </IfModule>
187     </IfModule>
188
189 </Location>
190
191 # ----------------------------------------------------------------------------------
192 # Force SSL on the OPAC's "My Account" page
193 # ----------------------------------------------------------------------------------
194 <LocationMatch .*/myopac.xml>
195     SSLRequireSSL
196 </LocationMatch>
197
198 <LocationMatch /opac/extras/>
199     # Force to en-US for now to satisfy bbags.xml
200     SetEnv locale en-US
201     Options +Includes
202     AddOutputFilter INCLUDES .xml
203     AddType application/xhtml+xml .xml
204 </LocationMatch>
205
206 RewriteEngine ON
207 RewriteCond %{QUERY_STRING} locale=([^&]*)
208 RewriteRule ^/opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/(.*)$ /opac/%1/extras/slimpac/$1? [redirect]
209 <LocationMatch /opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/>
210     AddOutputFilter INCLUDES;XMLENT .html
211 </LocationMatch>
212
213 # ----------------------------------------------------------------------------------
214 # Run server-side XUL and XHTML through xmlent to load the correct XML entities
215 # ----------------------------------------------------------------------------------
216 RewriteEngine ON
217 RewriteCond %{HTTP:Accept-Language} ([a-z]{2}-[A-Z]{2})
218 RewriteRule ^/xul/      -       [E=locale:%1]
219 RewriteRule ^/reports/  -       [E=locale:%1] [L]
220
221 # Default to en-US if we haven't matched a locale of the form xx-YY 
222 RewriteEngine ON
223 RewriteCond %{HTTP:Accept-Language} !([a-z]{2}-[A-Z]{2})
224 RewriteRule ^/xul/      -       [E=locale:en-US]
225 RewriteRule ^/reports/  -       [E=locale:en-US] [L]
226
227 # Default to en-US if we are just given en
228 RewriteEngine ON
229 RewriteCond %{ENV:locale} ^$ [OR]
230 RewriteCond %{ENV:locale} ^en$
231 RewriteRule - - [E=locale:en-US] [L]
232
233 <LocationMatch /xul/.*\.x?html$>
234     Options +Includes
235     XMLEntEscapeScript "no"
236     XMLEntStripComments "yes"
237     XMLEntStripPI "yes"
238     XMLEntStripDoctype "yes"
239     XMLEntContentType "text/html; charset=utf-8"
240     AddOutputFilter INCLUDES;XMLENT .xhtml
241     AddOutputFilter INCLUDES;XMLENT .html
242     allow from all
243 </LocationMatch>
244
245
246 <LocationMatch /xul/.*\.xul$>
247     Options +Includes
248     XMLEntContentType "application/vnd.mozilla.xul+xml"
249     AddOutputFilter INCLUDES;XMLENT .xul
250     allow from all
251 </LocationMatch>
252
253 # ----------------------------------------------------------------------------------
254 # Self-serve password interface
255 # ----------------------------------------------------------------------------------
256 <Location /opac/password>
257     SetHandler perl-script
258     PerlHandler OpenILS::WWW::PasswordReset::password_reset
259     Options +ExecCGI
260     PerlSendHeader On
261     allow from all
262
263     # Force clients to use HTTPS
264     RewriteEngine On
265     RewriteCond %{HTTPS} !=on [NC]
266     RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
267 </Location>
268
269 # ----------------------------------------------------------------------------------
270 # Supercat feeds
271 # ----------------------------------------------------------------------------------
272 <Location /opac/extras/oisbn>
273     SetHandler perl-script
274     PerlHandler OpenILS::WWW::SuperCat::oisbn
275     Options +ExecCGI
276     PerlSendHeader On
277     allow from all
278 </Location>
279 <Location /opac/extras/supercat>
280     SetHandler perl-script
281     PerlHandler OpenILS::WWW::SuperCat::supercat
282     Options +ExecCGI
283     PerlSendHeader On
284     allow from all
285 </Location>
286 <Location /opac/extras/unapi>
287     SetHandler perl-script
288     PerlHandler OpenILS::WWW::SuperCat::unapi
289     Options +ExecCGI
290     PerlSendHeader On
291     allow from all
292 </Location>
293 <Location /opac/extras/feed/bookbag>
294     SetHandler perl-script
295     PerlHandler OpenILS::WWW::SuperCat::bookbag_feed
296     Options +ExecCGI
297     PerlSendHeader On
298     allow from all
299 </Location>
300 <Location /opac/extras/opensearch>
301     SetHandler perl-script
302     PerlHandler OpenILS::WWW::SuperCat::opensearch_feed
303     Options +ExecCGI
304     PerlSendHeader On
305     allow from all
306 </Location>
307 <Location /opac/extras/sru>
308     SetHandler perl-script
309     PerlHandler OpenILS::WWW::SuperCat::sru_search
310     Options +ExecCGI
311     PerlSendHeader On
312     allow from all
313 </Location>
314 <Location /opac/extras/feed/freshmeat>
315     SetHandler perl-script
316     PerlHandler OpenILS::WWW::SuperCat::changes_feed
317     Options +ExecCGI
318     PerlSendHeader On
319     allow from all
320 </Location>
321 <Location /opac/extras/browse>
322     SetHandler perl-script
323     PerlHandler OpenILS::WWW::SuperCat::string_browse
324     Options +ExecCGI
325     PerlSendHeader On
326     allow from all
327 </Location>     
328 <Location /opac/extras/startwith>
329     SetHandler perl-script
330     PerlHandler OpenILS::WWW::SuperCat::string_startwith
331     Options +ExecCGI
332     PerlSendHeader On
333     allow from all
334 </Location>     
335         
336 # ----------------------------------------------------------------------------------
337 # Module for displaying OpenSRF API documentation
338 # ----------------------------------------------------------------------------------
339 <Location /opac/extras/docgen.xsl>
340     AddOutputFilter INCLUDES .xsl
341 </Location>
342
343 # ----------------------------------------------------------------------------------
344 # Module for processing staff-client offline scripts lives here
345 # ----------------------------------------------------------------------------------
346 <Directory "/openils/var/cgi-bin/offline">
347     AddHandler cgi-script .pl
348     AllowOverride None
349     Options +ExecCGI
350     allow from all
351 </Directory>
352         
353         
354 # ----------------------------------------------------------------------------------
355 # XXX Note, it's important to explicitly set the JSON encoding style 
356 # (OSRFGatewayLegacyJSON), since the default encoding style will likely change 
357 # with OpenSRF 1.0
358 # ----------------------------------------------------------------------------------
359 # OpenSRF JSON legacy gateway
360 # ----------------------------------------------------------------------------------
361 <Location /gateway>
362     SetHandler osrf_json_gateway_module
363     OSRFGatewayLegacyJSON "true"
364     allow from all
365 </Location>
366 # ----------------------------------------------------------------------------------
367 # New-style OpenSRF JSON gateway
368 # ----------------------------------------------------------------------------------
369 <Location /osrf-gateway-v1>
370     SetHandler osrf_json_gateway_module
371     OSRFGatewayLegacyJSON "false"
372     allow from all
373 </Location>
374
375 # ----------------------------------------------------------------------------------
376 # OpenSRF-over-HTTP translator
377 # (http://open-ils.org/dokuwiki/doku.php?id=opensrf_over_http)
378 # ----------------------------------------------------------------------------------
379 <Location /osrf-http-translator>
380     SetHandler osrf_http_translator_module
381     allow from all
382 </Location>
383
384 # ----------------------------------------------------------------------------------
385 # The exporter lives here
386 # ----------------------------------------------------------------------------------
387 <Location /exporter>
388     SetHandler perl-script
389     PerlSetVar OILSProxyTitle "Exporter Login"
390     PerlSetVar OILSProxyDescription "Please log in with an authorized staff account to export records"
391     PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
392     PerlHandler OpenILS::WWW::Proxy OpenILS::WWW::Exporter
393     Options +ExecCGI
394     PerlSendHeader On
395     allow from all
396 </Location>
397
398 # ----------------------------------------------------------------------------------
399 # Reporting output lives here
400 # ----------------------------------------------------------------------------------
401 <Location /reporter/>
402     SetHandler perl-script
403     PerlSetVar OILSProxyTitle "Report Login"
404     PerlSetVar OILSProxyDescription "Please log in with an authorized staff account to view this report"
405     PerlSetVar OILSProxyPermissions "VIEW_REPORT_OUTPUT"
406     PerlHandler OpenILS::WWW::Proxy
407     Options +ExecCGI
408     PerlSendHeader On
409     allow from all
410 </Location>
411
412 # ----------------------------------------------------------------------------------
413 # Selfcheck interface
414 # ----------------------------------------------------------------------------------
415 <LocationMatch .*/selfcheck.xml>
416     SetHandler perl-script
417     PerlSetVar OILSProxyTitle "Self-check Login"
418     PerlSetVar OILSProxyDescription "Please log in with an authorized staff account to activate the self-check interface"
419     PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
420     PerlHandler OpenILS::WWW::Proxy
421     Options +ExecCGI
422     PerlSendHeader On
423     allow from all
424 </LocationMatch>
425
426
427 # ----------------------------------------------------------------------------------
428 # Reports GUI
429 # ----------------------------------------------------------------------------------
430 <LocationMatch /reports>
431     Options +Includes
432     AddOutputFilter INCLUDES;XMLENT .xhtml
433 </LocationMatch>
434
435 <LocationMatch /reports/fm_IDL.xml>
436     IDLChunkStripPI "yes"
437     IDLChunkEscapeScript "no"
438     IDLChunkStripComments "yes"
439     IDLChunkStripDoctype "yes"
440     IDLChunkContentType "application/xml; charset=utf-8"
441     AddOutputFilter INCLUDES;IDLCHUNK .xml
442 </LocationMatch>
443
444 # ----------------------------------------------------------------------------------
445 # EDI Message viewer
446 # ----------------------------------------------------------------------------------
447 <Location /edi>
448     SetHandler perl-script
449     PerlHandler OpenILS::WWW::EDI
450     Options +ExecCGI
451     PerlSendHeader On
452     allow from all
453 </Location>     
454
455 # ----------------------------------------------------------------------------------
456 # XML-RPC gateway
457 # ----------------------------------------------------------------------------------
458 <Location /xml-rpc>
459     SetHandler perl-script
460     PerlHandler OpenILS::WWW::XMLRPCGateway
461     Options +ExecCGI
462     PerlSendHeader On
463     allow from all
464 </Location>
465
466 # ----------------------------------------------------------------------------------
467 # Conify - next-generation Evergreen administration interface
468 # ----------------------------------------------------------------------------------
469 RewriteEngine on
470 RewriteRule ^/conify/([a-z]{2}-[A-Z]{2})/global/(.*)$ /conify/global/$2 [E=locale:$1,L]
471 <Location /conify>
472     Options +Includes
473     XMLEntStripPI "yes"
474     XMLEntEscapeScript "no"
475     XMLEntStripComments "no"
476     XMLEntContentType "text/html; charset=utf-8"
477     AddOutputFilter INCLUDES;XMLENT .html
478  
479     SetHandler perl-script
480     PerlSetVar OILSProxyTitle "Dojo Admin Login"
481     PerlSetVar OILSProxyDescription "Please log in with an authorized staff account to administer Evergreen"
482     PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
483     PerlHandler OpenILS::WWW::Proxy
484     Options +ExecCGI
485     PerlSendHeader On
486     allow from all
487 </Location>
488
489 # ----------------------------------------------------------------------------------
490 # Vandelay importers / exporters (your Web interface to bibliographic travel)
491 # ----------------------------------------------------------------------------------
492 RedirectMatch 301 ^/vandelay/vandelay.xml(.*)$ /vandelay/en-US/vandelay.xml$1
493
494 RewriteEngine on
495 RewriteRule ^/vandelay/([a-z]{2}-[A-Z]{2})/(.*)$ /vandelay/$2 [E=locale:$1]
496
497 <LocationMatch /vandelay.*xml>
498     XMLEntStripPI "yes"
499     XMLEntEscapeScript "no"
500     XMLEntStripComments "yes"
501     XMLEntContentType "text/html; charset=utf-8"
502     XMLEntStripDoctype "yes"
503     AddOutputFilter INCLUDES;XMLENT .xml
504         SetHandler perl-script
505         PerlSetVar OILSProxyTitle "Vandelay Login"
506         PerlSetVar OILSProxyDescription "Please log in with an authorized staff account to import MARC records"
507         PerlSetVar OILSProxyPermissions "IMPORT_MARC"
508         PerlHandler OpenILS::WWW::Proxy
509         Options +ExecCGI
510         PerlSendHeader On
511         allow from all
512 </LocationMatch>
513 <Location /vandelay-upload>
514     SetHandler perl-script
515     PerlHandler OpenILS::WWW::Vandelay::spool_marc
516     Options +ExecCGI
517     allow from all
518 </Location>
519
520 # OpenURL 0.1 searching based on OpenSearch
521 RewriteEngine on
522 RewriteMap openurl prg:/openils/bin/openurl_map.pl
523 RewriteCond %{QUERY_STRING} (^.*$)
524 RewriteRule ^/openurl$ ${openurl:%1} [NE,PT]
525
526
527
528 # General Evergreen web template processor
529 <Location /eg>
530     SetHandler perl-script
531     PerlHandler OpenILS::WWW::EGWeb
532     Options +ExecCGI
533     PerlSendHeader On
534     allow from all
535 </Location>
536 # Note: the template processor will decline handling anything it does not
537 # have an explicit configuration for, which means it will fall back to 
538 # Apache to serve the file.  However, in the interest of speed, go ahead 
539 # and tell Apache to avoid asking OpenILS::WWW::EGWeb for static content.
540 # Add more exemptions as needed.
541 <LocationMatch ^/eg/.*(\.js|\.css|\.html|\.xhtml|\.xml|\.jpg|\.png|\.gif)$>
542     SetHandler None
543 </LocationMatch>
544
545 # ----------------------------------------------------------------------------------
546 # Some mod_deflate logging setup
547 # ----------------------------------------------------------------------------------
548 <IfModule mod_deflate.c>
549     DeflateFilterNote Input instream
550     DeflateFilterNote Output outstream
551     DeflateFilterNote Ratio ratio
552
553     LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
554     CustomLog /var/log/apache2/deflate_log deflate
555 </IfModule>
556