フォーム画面のリクエスト後、CloudFrontにて403のエラーが発生しています。
内容から、HTTPSでのリクエストでないことが主な原因と記述はあります。
一方で、リクエストのURLを見ると、httpsでリクエストしているように見えます。
原因分かる方いらっしゃいましたら教えて下さい。以下情報です。他必要な情報ありましたらご教示ください。
【詳細事象】
・自作WEBサイトにて、問い合わせフォーム作成。問い合わせ項目入力後、「送信」ボタン押下後に発生
・サーバはNodejsで記載。
・添付画像から、リクエストURLはhttps://で送られているはず。
・AWSのドキュメントを確認し、Cloudfrontでの設定で「ビューワープロトコルポリシー」を「HTTP を HTTPS にリダイレクト」に設定していることを確認
・publicフォルダは以下は、S3にて静的コンテンツを配信
・フォーム送信時のリクエストはPOSTメソッド
【ソースコード】
HTML
1<form action="" method="POST" id="form_submit"> 2 <p> 3 ニックネーム*<br> 4 <input class="form-style checkform charcheck" type="text" name="name" required><br> 5 <span class="alertarea"></span> 6 </p> 7※以下は省略
Nodejs
1app.use("/public/menu/form", require("./routes/index.js")); 2 3※下記のrouterモジュールを呼び出し
nodejs
1router.post("/public/menu/form", (req,res) => { 2 const msg = req.body ; 3 4※関係ないので省略 5 6 // DynamoDBへのデータPut 7 docClient.put(formparams, function(err, data){ 8 if(err){ 9 console.error("Unable to add formdata", msg.title, ". Error JSON:", JSON.stringify(err, null, 2)); 10 res.sendFile("https://www2-prd-hero-blog.com/public/menu/form/form-failure.html"); 11 }else { 12 console.log("PutItem succeeded:", msg.title); 13 res.sendFile("https://www2-prd-hero-blog.com/public/menu/form/form-success.html"); 14 } 15 }); 16});
あなたの回答
tips
プレビュー