]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/examples/apache/eg_vhost.conf
added OPAC support for 1) selecting SSL manually and having it stick and 2) forcing...
[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
106     # Specify the initial script URL for Novelist (containing account credentials, etc.)
107     #SetEnv OILS_NOVELIST_URL
108     
109
110     # Uncomment to force SSL any time a patron is logged in.  This protects 
111     # authentication tokens.  Left commented out for backwards compat for now.
112     #SetEnv OILS_OPAC_FORCE_LOGIN_SSL 1
113
114 </LocationMatch>
115
116
117 # ----------------------------------------------------------------------------------
118 # Force SSL on the OPAC's "My Account" page
119 # ----------------------------------------------------------------------------------
120 <LocationMatch .*/myopac.xml>
121     SSLRequireSSL
122 </LocationMatch>
123
124 <LocationMatch /opac/extras/>
125     # Force to en-US for now to satisfy bbags.xml
126     SetEnv locale en-US
127     Options +Includes
128     AddOutputFilter INCLUDES .xml
129     AddType application/xhtml+xml .xml
130 </LocationMatch>
131
132 RewriteEngine ON
133 RewriteCond %{QUERY_STRING} locale=([^&]*)
134 RewriteRule ^/opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/(.*)$ /opac/%1/extras/slimpac/$1? [redirect]
135 <LocationMatch /opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/>
136     AddOutputFilter INCLUDES;XMLENT .html
137 </LocationMatch>
138
139 # ----------------------------------------------------------------------------------
140 # Run server-side XUL and XHTML through xmlent to load the correct XML entities
141 # ----------------------------------------------------------------------------------
142 RewriteEngine ON
143 RewriteCond %{HTTP:Accept-Language} ([a-z]{2}-[A-Z]{2})
144 RewriteRule ^/xul/      -       [E=locale:%1]
145 RewriteRule ^/reports/  -       [E=locale:%1] [L]
146
147 # Default to en-US if we haven't matched a locale of the form xx-YY 
148 RewriteEngine ON
149 RewriteCond %{HTTP:Accept-Language} !([a-z]{2}-[A-Z]{2})
150 RewriteRule ^/xul/      -       [E=locale:en-US]
151 RewriteRule ^/reports/  -       [E=locale:en-US] [L]
152
153 # Default to en-US if we are just given en
154 RewriteEngine ON
155 RewriteCond %{ENV:locale} ^$ [OR]
156 RewriteCond %{ENV:locale} ^en$
157 RewriteRule - - [E=locale:en-US] [L]
158
159 <LocationMatch /xul/.*\.x?html$>
160     Options +Includes
161     XMLEntEscapeScript "no"
162     XMLEntStripComments "yes"
163     XMLEntStripPI "yes"
164     XMLEntStripDoctype "yes"
165     XMLEntContentType "text/html; charset=utf-8"
166     AddOutputFilter INCLUDES;XMLENT .xhtml
167     AddOutputFilter INCLUDES;XMLENT .html
168     allow from all
169 </LocationMatch>
170
171
172 <LocationMatch /xul/.*\.xul$>
173     Options +Includes
174     XMLEntContentType "application/vnd.mozilla.xul+xml"
175     AddOutputFilter INCLUDES;XMLENT .xul
176     allow from all
177 </LocationMatch>
178
179 # ----------------------------------------------------------------------------------
180 # Self-serve password interface
181 # ----------------------------------------------------------------------------------
182 <Location /opac/password>
183     SetHandler perl-script
184     PerlHandler OpenILS::WWW::PasswordReset::password_reset
185     Options +ExecCGI
186     PerlSendHeader On
187     allow from all
188
189     # Force clients to use HTTPS
190     RewriteEngine On
191     RewriteCond %{HTTPS} !=on [NC]
192     RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
193 </Location>
194
195 # ----------------------------------------------------------------------------------
196 # Supercat feeds
197 # ----------------------------------------------------------------------------------
198 <Location /opac/extras/oisbn>
199     SetHandler perl-script
200     PerlHandler OpenILS::WWW::SuperCat::oisbn
201     Options +ExecCGI
202     PerlSendHeader On
203     allow from all
204 </Location>
205 <Location /opac/extras/supercat>
206     SetHandler perl-script
207     PerlHandler OpenILS::WWW::SuperCat::supercat
208     Options +ExecCGI
209     PerlSendHeader On
210     allow from all
211 </Location>
212 <Location /opac/extras/unapi>
213     SetHandler perl-script
214     PerlHandler OpenILS::WWW::SuperCat::unapi
215     Options +ExecCGI
216     PerlSendHeader On
217     allow from all
218 </Location>
219 <Location /opac/extras/feed/bookbag>
220     SetHandler perl-script
221     PerlHandler OpenILS::WWW::SuperCat::bookbag_feed
222     Options +ExecCGI
223     PerlSendHeader On
224     allow from all
225 </Location>
226 <Location /opac/extras/opensearch>
227     SetHandler perl-script
228     PerlHandler OpenILS::WWW::SuperCat::opensearch_feed
229     Options +ExecCGI
230     PerlSendHeader On
231     allow from all
232 </Location>
233 <Location /opac/extras/sru>
234     SetHandler perl-script
235     PerlHandler OpenILS::WWW::SuperCat::sru_search
236     Options +ExecCGI
237     PerlSendHeader On
238     allow from all
239 </Location>
240 <Location /opac/extras/feed/freshmeat>
241     SetHandler perl-script
242     PerlHandler OpenILS::WWW::SuperCat::changes_feed
243     Options +ExecCGI
244     PerlSendHeader On
245     allow from all
246 </Location>
247 <Location /opac/extras/browse>
248     SetHandler perl-script
249     PerlHandler OpenILS::WWW::SuperCat::string_browse
250     Options +ExecCGI
251     PerlSendHeader On
252     allow from all
253 </Location>     
254         
255 # ----------------------------------------------------------------------------------
256 # Module for displaying OpenSRF API documentation
257 # ----------------------------------------------------------------------------------
258 <Location /opac/extras/docgen.xsl>
259     AddOutputFilter INCLUDES .xsl
260 </Location>
261
262 # ----------------------------------------------------------------------------------
263 # Module for processing staff-client offline scripts lives here
264 # ----------------------------------------------------------------------------------
265 <Directory "/openils/var/cgi-bin/offline">
266     AddHandler cgi-script .pl
267     AllowOverride None
268     Options +ExecCGI
269     allow from all
270 </Directory>
271         
272         
273 # ----------------------------------------------------------------------------------
274 # XXX Note, it's important to explicitly set the JSON encoding style 
275 # (OSRFGatewayLegacyJSON), since the default encoding style will likely change 
276 # with OpenSRF 1.0
277 # ----------------------------------------------------------------------------------
278 # OpenSRF JSON legacy gateway
279 # ----------------------------------------------------------------------------------
280 <Location /gateway>
281     SetHandler osrf_json_gateway_module
282     OSRFGatewayLegacyJSON "true"
283     allow from all
284 </Location>
285 # ----------------------------------------------------------------------------------
286 # New-style OpenSRF JSON gateway
287 # ----------------------------------------------------------------------------------
288 <Location /osrf-gateway-v1>
289     SetHandler osrf_json_gateway_module
290     OSRFGatewayLegacyJSON "false"
291     allow from all
292 </Location>
293
294 # ----------------------------------------------------------------------------------
295 # OpenSRF-over-HTTP translator
296 # (http://open-ils.org/dokuwiki/doku.php?id=opensrf_over_http)
297 # ----------------------------------------------------------------------------------
298 <Location /osrf-http-translator>
299     SetHandler osrf_http_translator_module
300     allow from all
301 </Location>
302
303 # ----------------------------------------------------------------------------------
304 # The exporter lives here
305 # ----------------------------------------------------------------------------------
306 <Location /exporter>
307     SetHandler perl-script
308     PerlSetVar OILSProxyTitle "Exporter Login"
309     PerlSetVar OILSProxyDescription "Please log in to export records"
310     PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
311     PerlHandler OpenILS::WWW::Proxy OpenILS::WWW::Exporter
312     Options +ExecCGI
313     PerlSendHeader On
314     allow from all
315 </Location>
316
317 # ----------------------------------------------------------------------------------
318 # Reporting output lives here
319 # ----------------------------------------------------------------------------------
320 <Location /reporter/>
321     SetHandler perl-script
322     PerlSetVar OILSProxyTitle "Report Login"
323     PerlSetVar OILSProxyDescription "Please log in to view this report"
324     PerlSetVar OILSProxyPermissions "VIEW_REPORT_OUTPUT"
325     PerlHandler OpenILS::WWW::Proxy
326     Options +ExecCGI
327     PerlSendHeader On
328     allow from all
329 </Location>
330
331 # ----------------------------------------------------------------------------------
332 # Selfcheck interface
333 # ----------------------------------------------------------------------------------
334 <LocationMatch .*/selfcheck.xml>
335     SetHandler perl-script
336     PerlSetVar OILSProxyTitle "Selfcheck Login"
337     PerlSetVar OILSProxyDescription "Please log in to activate the selfcheck interface"
338     PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
339     PerlHandler OpenILS::WWW::Proxy
340     Options +ExecCGI
341     PerlSendHeader On
342     allow from all
343 </LocationMatch>
344
345
346 # ----------------------------------------------------------------------------------
347 # Reports GUI
348 # ----------------------------------------------------------------------------------
349 <LocationMatch /reports>
350     Options +Includes
351     AddOutputFilter INCLUDES;XMLENT .xhtml
352 </LocationMatch>
353
354 <LocationMatch /reports/fm_IDL.xml>
355     IDLChunkStripPI "yes"
356     IDLChunkEscapeScript "no"
357     IDLChunkStripComments "yes"
358     IDLChunkStripDoctype "yes"
359     IDLChunkContentType "application/xml; charset=utf-8"
360     AddOutputFilter INCLUDES;IDLCHUNK .xml
361 </LocationMatch>
362
363 # ----------------------------------------------------------------------------------
364 # XML-RPC gateway
365 # ----------------------------------------------------------------------------------
366 <Location /xml-rpc>
367     SetHandler perl-script
368     PerlHandler OpenILS::WWW::XMLRPCGateway
369     Options +ExecCGI
370     PerlSendHeader On
371     allow from all
372 </Location>
373
374 # ----------------------------------------------------------------------------------
375 # Conify - next-generation Evergreen administration interface
376 # ----------------------------------------------------------------------------------
377 RewriteEngine on
378 RewriteRule ^/conify/([a-z]{2}-[A-Z]{2})/global/(.*)$ /conify/global/$2 [E=locale:$1,L]
379 <Location /conify>
380     Options +Includes
381     XMLEntStripPI "yes"
382     XMLEntEscapeScript "no"
383     XMLEntStripComments "no"
384     XMLEntContentType "text/html; charset=utf-8"
385     AddOutputFilter INCLUDES;XMLENT .html
386  
387     SetHandler perl-script
388     PerlSetVar OILSProxyTitle "Dojo Admin Login"
389     PerlSetVar OILSProxyDescription "Please log in to administer Evergreen"
390     PerlSetVar OILSProxyPermissions "STAFF_LOGIN"
391     PerlHandler OpenILS::WWW::Proxy
392     Options +ExecCGI
393     PerlSendHeader On
394     allow from all
395 </Location>
396
397 # ----------------------------------------------------------------------------------
398 # Vandelay importers / exporters (your Web interface to bibliographic travel)
399 # ----------------------------------------------------------------------------------
400 RedirectMatch 301 ^/vandelay/vandelay.xml(.*)$ /vandelay/en-US/vandelay.xml$1
401
402 RewriteEngine on
403 RewriteRule ^/vandelay/([a-z]{2}-[A-Z]{2})/(.*)$ /vandelay/$2 [E=locale:$1]
404
405 <LocationMatch /vandelay.*xml>
406     XMLEntStripPI "yes"
407     XMLEntEscapeScript "no"
408     XMLEntStripComments "yes"
409     XMLEntContentType "text/html; charset=utf-8"
410     XMLEntStripDoctype "yes"
411     AddOutputFilter INCLUDES;XMLENT .xml
412         SetHandler perl-script
413         PerlSetVar OILSProxyTitle "Vandelay Login"
414         PerlSetVar OILSProxyDescription "Please log in to import MARC records"
415         PerlSetVar OILSProxyPermissions "IMPORT_MARC"
416         PerlHandler OpenILS::WWW::Proxy
417         Options +ExecCGI
418         PerlSendHeader On
419         allow from all
420 </LocationMatch>
421 <Location /vandelay-upload>
422     SetHandler perl-script
423     PerlHandler OpenILS::WWW::Vandelay::spool_marc
424     Options +ExecCGI
425     allow from all
426 </Location>
427
428 # OpenURL 0.1 searching based on OpenSearch
429 RewriteEngine on
430 RewriteMap openurl prg:/openils/bin/openurl_map.pl
431 RewriteCond %{QUERY_STRING} (^.*$)
432 RewriteRule ^/openurl$ ${openurl:%1} [NE,PT]
433
434
435
436 # General Evergreen web template processor
437 <Location /eg>
438     SetHandler perl-script
439     PerlHandler OpenILS::WWW::EGWeb
440     Options +ExecCGI
441     PerlSendHeader On
442     allow from all
443 </Location>
444 # Note: the template processor will decline handling anything it does not
445 # have an explicit configuration for, which means it will fall back to 
446 # Apache to serve the file.  However, in the interest of speed, go ahead 
447 # and tell Apache to avoid asking OpenILS::WWW::EGWeb for static content.
448 # Add more exemptions as needed.
449 <LocationMatch ^/eg/.*(\.js|\.css|\.html|\.xhtml|\.xml|\.jpg|\.png|\.gif)$>
450     SetHandler None
451 </LocationMatch>
452
453