LoginSignup
0
0

More than 5 years have passed since last update.

groonga-httpdを他のサーバから呼び出す場合

Posted at

groonga-httpdをjsonで他のサーバーから呼び出し結果を使う場合にはヘッダーにAccess-Control-Allow-Originを追加しないといけません。

add_headerにて追加します。

/etc/groonga/httpd/groonga-httpd.conf
 server {
    listen 10041;
    server_name localhost;

    location /d/ {
      groonga on;
      # You can disable log for groonga.
      # groonga_log_path off;
      # You can disable query log for groonga.
      # groonga_query_log_path off;
      # You can custom database path.
      # groonga_database /path/to/groonga/db;
      add_header 'Access-Control-Allow-Origin' '*';
      add_header 'Access-Control-Allow-Credentials' 'true';
      add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    }
    ....

以下のコマンドで再起動します。

/etc/init.d/groonga-httpd restart

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0