반응형
React를 IIS에서 구동했을 떄 새로고침 시 404에러가 뜨는 경우가 있다.
SPA 특성상 새로고침 시 Router에서의 URI 인식 등으로 인해 404 에러가 뜰 것이다.
물론 서버단에서 새로고침 요청 시 잘 만들면 되겠지만
IIS의 web.config를 아래와 같이 설정하면 방지할 수 있다.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="/" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>
반응형
'기술의기록' 카테고리의 다른 글
[HTML]아코디언 메뉴 쉽게 만드는 태그 Details (21) | 2022.02.07 |
---|---|
[Javascript] 배열 앞뒤값을 활용하는 Array.prototype.reduce (4) | 2022.02.04 |
[HTML] 프로그래스바 1분만에 만들기 (12) | 2022.01.24 |
[HTML] input의 자동완성 기능 datalist (6) | 2022.01.19 |
[Javascript]배열 내장 반복 함수(Prototype) 7개 정리(forEach,map,filter,some,every,find,findIndex) (0) | 2022.01.07 |