Skip to content

AWS Amplify

앱 백엔드 생성 / 프론트엔드 웹 UI 구축 / 웹 앱 호스팅

Categories

Amplify CLI

CLI로 직접 업로드 하는 방법

자세한 내용은 AWS:CLI:Amplify 항목 참조.

Git Provider없이 배포하기

타사 DNS 공급자가 관리하는 사용자 지정 도메인 추가

AWS:Amplify:Domain 항목 참조.

Using redirects

단일 페이지 웹 앱 (SPA) 용 리디렉션

대부분의 SPA 프레임워크는 HTML5 history.pushState()를 지원하여 서버 요청을 트리거하지 않고 브라우저 위치를 변경합니다. 이는 루트(또는 /index.html)에서 여정을 시작하지만 다른 페이지로 직접 이동하는 사용자에게는 적합하지 않습니다. 다음 예제에서는 정규 표현식을 사용하여 정규 표현식에 지정된 특정 파일 확장자를 제외한 모든 파일을 index.html 파일에 재작성(200)하도록 설정합니다.

원본 주소

대상 주소

리디렉션 유형

국가 코드

/index.html

200

Custom headers

Security headers example

Custom security headers enable enforcing HTTPS, preventing XSS attacks, and defending your browser against clickjacking. Use the following YAML syntax to apply custom security headers to your app.

customHeaders:
  - pattern: '**'
    headers:
      - key: 'Strict-Transport-Security'
        value: 'max-age=31536000; includeSubDomains'
      - key: 'X-Frame-Options'
        value: 'SAMEORIGIN'
      - key: 'X-XSS-Protection'
        value: '1; mode=block'
      - key: 'X-Content-Type-Options'
        value: 'nosniff'
      - key: 'Content-Security-Policy'
        value: "default-src 'self'"
  • Strict-Transport-Security
  • X-Frame-Options
  • X-XSS-Protection
  • X-Content-Type-Options
  • Content-Security-Policy

index.html 파일 캐시 금지

Cache Busting문제를 해결하기 위해 사용한다. 보통 SPA에서 사용하면 된다.

customHeaders:
  - pattern: '/index.html'
    headers: &cacheBustingGuard
      - key: 'Cache-Control'
        value: 'no-cache, no-store, must-revalidate'
  - pattern: '/favicon.ico'
    headers: *cacheBustingGuard
  - pattern: '/logo*.png'
    headers: *cacheBustingGuard
  - pattern: '/*manifest.json'
    headers: *cacheBustingGuard
  - pattern: '/robots.txt'
    headers: *cacheBustingGuard
  - pattern: '/service-worker.js*'
    headers: *cacheBustingGuard

See also

Favorite site

Getting started