Nuxt.js에서 API CORS 대책을하면 Netlify에서 404 오류가 발생합니다.
개요
Nuxt 설정
.envBASE_API_URL="http://localhost"
BASE_CACHE_URL="http://localhost"
nuxt.config.js
const baseApiUrl = process.env.BASE_API_URL || "http://localhost";
const baseCacheiUrl = process.env.BASE_CACHE_URL || "http://localhost";
export default {
...
  /*
   ** Axios module configuration
   */
  axios: {
    credentials: true,
    proxy: true,
    debug: true
  },
  proxy: {
    "/caches/": baseCacheiUrl,
    "/game/": baseApiUrl,
    "/common/": baseApiUrl
  },
Nuxt 설정
로컬 환경에서의 동작 검증
성공적으로 API 통신이 가능한 패턴

Netlify에 배포
움직이지 않는다
API 응답은 200이 반환되었지만 404 페이지의 DOM이 반환되는 패턴

대책
static/_redirectsNetlify 리디렉션 옵션 설정
htps : // / cs. 네 tぃfy. 코 m / 로 센 g / 레 cts / 레
+ /game/*  https://api.deckup.cards/game/:splat  200
+ /common/*  https://api.deckup.cards/common/:splat  200
+ /caches/*  https://cache.deckup.cards/caches/:splat  200
/*    /index.html   200
결과
 
                Reference
이 문제에 관하여(Nuxt.js에서 API CORS 대책을하면 Netlify에서 404 오류가 발생합니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/takasu_mtg/items/9f7ef27a032710c06f61텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)