Обратный прокси CouchDB

я установил couchdb на моем корневом сервере. Теперь я пытаюсь разрешить только PUT-запросы к моей базе данных через прокси. Но я не могу заставить его работать.
Что я попробовал:

(.htaccess)
SetEnvIf Request_URI acraproxy acraproxy
RequestHeader set Authorization "Basic base64credentials" env=acraproxy
RewriteEngine On
RewriteRule ^acraproxy/(.*)$ http://localhost:5984/mydatabase/_design/acra-storage/_update/report/$1 [P]

Я всегда получаю код ошибки 405.
Я также попытался использовать скрипт PHP, как это:

<?php
$COUCH_INSTANCE = 'http://www.acmecouch.com'; // URL of your CouchDB instance
$COUCH_PORT = 80; // Port of your CouchDB instance
$REPORTER_USER = 'acra'; // Username of the reporter user
$REPORTER_PASSWORD = 'r3p0rts'; // Password for the reporter user
$APPNAME = 'myapp'; // the name of your app, same as defined when pushing your own acra-storage couchapp instance

if($_SERVER['REQUEST_METHOD'] === 'PUT') {
$curl = curl_init($COUCH_INSTANCE.'/acra-'.$APPNAME.'/_design/acra-storage/_update/report/'.$_GET["reportid"]);
curl_setopt($curl, CURLOPT_PORT, $COUCH_PORT);
curl_setopt($curl, CURLOPT_USERPWD, $REPORTER_USER . ":" . $REPORTER_PASSWORD);
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_PUT, true);
curl_setopt($curl, CURLOPT_INFILE, fopen("php://input","r"));
curl_setopt($curl, CURLOPT_INFILESIZE, $_SERVER['CONTENT_LENGTH']);
$result = curl_exec($curl);
echo $result;
} else {
// If not a PUT request, just get the root of the CouchDB.
// This allows to check with a browser that the path from your php server
// to the couch instance is operational.
$curl = curl_init($COUCH_INSTANCE);
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($curl);
echo $result;
}
?>

Но это терпит неудачу с ошибкой php:

CURLOPT_FOLLOWLOCATION
cannot be activated when an open_basedir is set

Я следовал этому уроку: https://github.com/ACRA/acralyzer/wiki/Setting-up-a-reverse-proxy

Может кто-то помочь мне с этим?

2

Решение

Хорошо, я нашел проблему сам:
Отсутствовал модуль apache (подмодуль прокси). Теперь вышеупомянутые решения работают безупречно.

0

Другие решения

Других решений пока нет …