Bugzilla – Attachment 42040 Details for
Bug 14747
RESTful API with reverse proxy configuration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14747: RESTful API with reverse proxy configuration
Bug-14747-RESTful-API-with-reverse-proxy-configura.patch (text/plain), 4.96 KB, created by
Julian Maurice
on 2015-08-27 17:10:06 UTC
(
hide
)
Description:
Bug 14747: RESTful API with reverse proxy configuration
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2015-08-27 17:10:06 UTC
Size:
4.96 KB
patch
obsolete
>From 423e353eb9acb2423237d0974d7f042903dd034d Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Mon, 3 Aug 2015 17:54:51 +0300 >Subject: [PATCH] Bug 14747: RESTful API with reverse proxy configuration > >OPTIONAL replacement to the > Bug 13799: RESTful API with Mojolicious and Swagger2 >httpd-configuration. > >Instead of having to go to your dns-provider, you can run the api from >your current virtualhost. > >Use these configurations to reverse proxy www.host.domain/v1/ to the >REST API. > >--------------------------- >:INSTALLATION INSTRUCTIONS: >--------------------------- > >You need > Bug 14448: Adding the REST API as a Hypnotoad service, koha-api-daemon. >to deploy the backend Mojolicous application as a FastCGI-daemon. > >Then add the modifications from etc/koha-httpd.conf >to your /etc/apache2/sites-enabled/koha.conf >and adjust paths to fit. > >..$ a2enmod proxy >..$ a2enmod proxy_http >..$ service apache2 restart > >Much recommended is > Bug 14458: Add SwaggerUI documentation for RESTful API >to browse your API capabilities. > >Then just go to > /v1/doc >to see the API autodocumentation. >--- > etc/koha-httpd.conf | 80 ++++++++++++++++------------------------------------- > 1 file changed, 24 insertions(+), 56 deletions(-) > >diff --git a/etc/koha-httpd.conf b/etc/koha-httpd.conf >index 4f1fc47..98ab216 100644 >--- a/etc/koha-httpd.conf >+++ b/etc/koha-httpd.conf >@@ -27,6 +27,18 @@ > # OVERRIDE_SYSPREF_NAMES for your staff intranet vhost > # SetEnv OVERRIDE_SYSPREF_PrefName Value > >+ ##REVERSE PROXY REQUESTS TO THE KOHA API DAEMON >+ Alias /v1/doc __INTRANET_CGI_DIR__/api/v1/doc >+ Alias /v1/swagger.json "__INTRANET_CGI_DIR__/api/v1/swagger.json" >+ >+ ProxyRequests Off #Disable anonymous forward proxying >+ ProxyPreserveHost On >+ ProxyPass /v1/doc ! >+ ProxyPass /v1/swagger.json ! >+ ProxyPass /v1/ http://localhost:8081/v1/ keepalive=On >+ ProxyPassReverse /v1/ http://localhost:8081/v1/ >+ ##REVERSE PROXYING OK >+ > <Directory "__OPAC_WWW_DIR__"> > Options -Indexes > </Directory> >@@ -112,20 +124,6 @@ > RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT] > RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT] > RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT] >- >- # REST API configuration >- Alias "/api" "__OPAC_CGI_DIR__/api" >- <Directory __OPAC_CGI_DIR__/api> >- Options +ExecCGI +FollowSymlinks >- AddHandler cgi-script .pl >- >- RewriteEngine On >- RewriteBase /api/ >- RewriteCond %{REQUEST_FILENAME} !-f >- RewriteCond %{REQUEST_FILENAME} !-d >- RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f >- RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L] >- </Directory> > </IfModule> > </VirtualHost> > >@@ -158,6 +156,18 @@ > ErrorDocument 404 /cgi-bin/koha/errors/404.pl > ErrorDocument 500 /cgi-bin/koha/errors/500.pl > >+ ##REVERSE PROXY REQUESTS TO THE KOHA API DAEMON >+ Alias /v1/doc __INTRANET_CGI_DIR__/api/v1/doc >+ Alias /v1/swagger.json "__INTRANET_CGI_DIR__/api/v1/swagger.json" >+ >+ ProxyRequests Off #Disable anonymous forward proxying >+ ProxyPreserveHost On >+ ProxyPass /v1/doc ! >+ ProxyPass /v1/swagger.json ! >+ ProxyPass /v1/ http://localhost:8081/v1/ keepalive=On >+ ProxyPassReverse /v1/ http://localhost:8081/v1/ >+ ##REVERSE PROXYING OK >+ > <Directory "__INTRANET_WWW_DIR__"> > Options -Indexes > </Directory> >@@ -228,47 +238,5 @@ > RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/detail\.pl?bib=$1 [PT] > RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT] > RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT] >- >- >- # REST API configuration >- Alias "/api" "__INTRANET_CGI_DIR__/api" >- <Directory __INTRANET_CGI_DIR__/api> >- Options +ExecCGI +FollowSymlinks >- AddHandler cgi-script .pl >- >- RewriteEngine On >- RewriteBase /api/ >- RewriteCond %{REQUEST_FILENAME} !-f >- RewriteCond %{REQUEST_FILENAME} !-d >- RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f >- RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L] >- </Directory> > </IfModule> > </VirtualHost> >- >-# Uncomment this VirtualHost to enable API access through >-# api.__WEBSERVER_HOST__:__WEBSERVER_PORT__ >-#<VirtualHost __WEBSERVER_IP__:__WEBSERVER_PORT__> >-# ServerAdmin __WEBMASTER_EMAIL__ >-# DocumentRoot __INTRANET_CGI_DIR__/api >-# ServerName api.__WEBSERVER_HOST__:__WEBSERVER_PORT__ >-# SetEnv KOHA_CONF "__KOHA_CONF_DIR__/koha-conf.xml" >-# SetEnv PERL5LIB "__PERL_MODULE_DIR__" >-# ErrorLog __LOG_DIR__/koha-api-error_log >-# >-# <IfModule mod_rewrite.c> >-# <Directory __INTRANET_CGI_DIR__/api> >-# Options +ExecCGI +FollowSymlinks >-# AddHandler cgi-script .pl >-# >-# RewriteEngine on >-# >-# RewriteRule ^api/(.*) $1 [L] >-# >-# RewriteCond %{REQUEST_FILENAME} !-f >-# RewriteCond %{REQUEST_FILENAME} !-d >-# RewriteCond %{DOCUMENT_ROOT}/$1/app.pl -f >-# RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L] >-# </Directory> >-# </IfModule> >-#</VirtualHost> >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14747
: 42040