Skip to content

Commit

Permalink
add custom error response
Browse files Browse the repository at this point in the history
  • Loading branch information
EndoNrak committed Oct 21, 2023
1 parent fcfab82 commit aec7d2e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:flutter_web_plugins/flutter_web_plugins.dart';
import 'router.dart' as Router;

Future main() async {
// setUrlStrategy(PathUrlStrategy());
setUrlStrategy(PathUrlStrategy());
// パスベースのURLストラテジーを設定 これがないと、authのリダイレクト時にhttps://hogehoge/#/にリダイレクトされてしまって認可コードを取得できない
runApp(
ProviderScope(
Expand Down
5 changes: 0 additions & 5 deletions terraform/resources/cloudfront-function.js

This file was deleted.

14 changes: 10 additions & 4 deletions terraform/resources/cloudfront.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,22 @@ resource "aws_cloudfront_distribution" "tetris-hosting-cloudfront" {
forward = "none"
}
}
function_association {
event_type = "viewer-request"
function_arn = aws_cloudfront_function.subpage-redirect-function.arn
}

viewer_protocol_policy = "redirect-to-https"
min_ttl = 0
default_ttl = 3600
max_ttl = 86400
}

# without this, requests to subpage requests (like "/page") directory goes to origin s3 bucket
# 404 error would be thrown by s3, because the bucket doesn't have such a file or folder
# resulting in cloudfront originated 403 response for client
custom_error_response {
error_caching_min_ttl = 86400
error_code = 403
response_code = 200
response_page_path = "/"
}

restrictions {
geo_restriction {
Expand Down

0 comments on commit aec7d2e

Please sign in to comment.