본문 바로가기

혼자해보는 공부

[헤로쿠] No 'Access-Control-Allow-Origin' header is present on the requested resource. net::ERR_FAILED 200

728x90

테스트때 잘되던 소켓서버가 헤로쿠에 올리니 이상해졌다.

헤로쿠에러시 200에러 가 발생할때가 있다.

cors에 값을 추가해주도록 하면 정상동작한다.

const io = socketIo(server, {
    cors: {
      AllowedHeaders: [
        "*"
    ],
    AllowedMethods: [
        "GET",
        "PUT",
        "POST",
        "DELETE"
    ],
    AllowedOrigins: [
          "헤로쿠서버 입력 ex)http://abcde.herokuaap.com"
    ],
    ExposeHeaders: []

    },
  });
728x90
댓글