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