簡體   English   中英

apache2和couchdb在apache2上啟用cors

[英]apache2 and couchdb enable cors on apache2

Hy,我想使用apache網站服務器上的couchbed,要使用它,我必須向該ouchdb服務器發出cors請求。 因此,我要做的是為apache創建一個新的VirtualHost配置,如下所示(localhost.maxbit89.conf):

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

    ServerAdmin webmaster@localhost
    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

但是我嘗試的任何請求都沒有特定的標題。 那么,有誰能告訴我如何正確使用couchdb + Apache?

好的,第一個問題是重新安裝apache標頭后,我的apache2配置如何損壞。

我有第二個問題,可以通過將其添加到/etc/couchdb/local.ini來解決:

[httpd]
enable_cors = true

[cors]
origins = *

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM