2016-04-10 12 views
0

Hy ApacheのWebサーバーからcouchdbを使用したいのですが、これを使用するにはcouchdbサーバーにcorsリクエストを作成する必要があります。 それでは、私はこれ(localhost.maxbit89.conf)のように見えるのapacheのための新しいのVirtualHostの設定を作成していたしました:apache2とcouchdbがapache2でcorsを有効にする

<VirtualHost *:80> 
     ServerAlias localhost.maxbit89 
    ServerName localhost.maxbit89 

    ServerAdmin [email protected] 
    DocumentRoot /var/www/localhost.maxbit89 
    <Directory /var/www/localhost.maxbit89/> 
     Options Indexes FollowSymLinks MultiViews 
       AllowOverride None 

     # Always set these headers. 
     Header always set Access-Control-Allow-Origin "*" 
     Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT" 
     Header always set Access-Control-Max-Age "1000" 
     Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token" 

     # Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request. 
     RewriteEngine On 
     RewriteCond %{REQUEST_METHOD} OPTIONS 
     RewriteRule ^(.*)$ $1 [R=200,L] 
    </Directory> 

    ErrorLog ${APACHE_LOG_DIR}/error.log 
    CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet 

しかし、私がしようと試みたすべての要求がspezifiedヘッダの非を持っています。 どのように私はどのようにcouchdb + apacheを正しい方法で使うのか教えていただけますか?

答えて

0

最初の問題は、ヘッダーが送信されたApacheを再インストールした後、私のapache2の設定がどのように壊れていたかです。

[httpd] 
enable_cors = true 

[cors] 
origins = * 

私は/etc/couchdb/local.iniするためにこれを追加することで解決された第二の問題がありました