LoginSignup
99
96

More than 5 years have passed since last update.

Nginx に CORS 用の設定をする。

Posted at

Nginx に CORS 用の設定をする。普通にコレで行けるね。

server {
    listen 80;
    server_name hoge.example.com;
    location / {
       add_header Access-Control-Allow-Origin *;
       add_header Access-Control-Allow-Methods "POST, GET, OPTIONS";
       add_header Access-Control-Allow-Headers "Origin, Authorization, Accept";
       add_header Access-Control-Allow-Credentials true;
       proxy_pass http://localhost:8888;
    }
}
99
96
2

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
99
96