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