Unique HTML Code:
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="farmapp.css">
</head>
<body onload="loadimg()">
<div id="sitehead"gt;
<div class="leftsection" onclick="location.href = 'mainsite.html';">
<div>
<img class="left-sunriseIMG" src="thumbnails/sunrise.jpg">
</div>
<div>
<h1 class="sitetitle">FARM</h1>
</div>
</div>
<div class="middlesection">
<div>
<!--
<input class="search-box" type="text" placeholder="Search District">
<label>Search using DISTRICT : </label>
-->
<button type="button" class="clearsearch" value="" onclick="location.href = 'mainsite.html';">x</button>
</div>
<div>
<button type="submit" class="search-button" onclick="SearchWithDistrict()">Search</button>
</div>
</div>
</div>
<div id="deals-box">
<div class="about" onclick="location.href = 'About.html';">About</div>
<div class="contact" onclick="location.href = 'contact.html';">contact</div>
<div class="post" onclick="location.href = 'FishImageUpload.html';">Post-AD</div>
<div class="edit" onclick="location.href = 'edit.html';">Edit-AD</div>
</div>
<div id="cimages"></div>
<div id="FullImageView">
<img id="FullImage" />
<button id="CloseButton" onclick="CloseFullView()">Close</button>
</div>
<div id="FullDetailsView">
<div id="ViewDetails"></div>
<button id="DetailsCloseButton" onclick="CloseDetailsView()">Cancel</button>
</div>
<script src="main.js"></script>
</body>
</html>
Javascript Function:
function loadimg() {
options = {
method: 'POST',
}
fetch('https://apfarmsite.com:8000/FarmSite', options)
.then(res => res.json())
.then(cust_data => { // Handling the response from the server
console.log(cust_data);
});
}
App.js Post Request:
app.post('/FarmSite', (req, res) => {
console.log(req.body);
})
I encountered an issue with my API connection when making a post request, specifically when using SSL which resulted in an SSL error. This only occurs when utilizing HTTPS instead of HTTP on my server with nginx. I have already enabled full traffic access in security groups for my EC2 instance. Do I need to make any adjustments to SSL/TLS protocol settings to resolve this problem?