LoginSignup
1
5

More than 3 years have passed since last update.

vuejs axios クロスドメイン対策

Posted at

postの場合、サーバサイドでなんとかなったが、
getの場合うまく行かなかったのでfrontエンドで下記のようにした

    data: () => ({
        ...
        headers: {
            'Content-Type': 'application/json;charset=UTF-8',
            'Access-Control-Allow-Origin': '*',
        }

        axios.get(this.apiBaseUrl + '(URL)', this.headers)
            .then((response) => {
                this.xxx = response.data;
            })


1
5
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
1
5