Fix Nginx 413 error for PDF uploads and html2canvas hidden styling

This commit is contained in:
2026-09-23 12:18:15 +05:30
parent 0b99b3a214
commit 6b1c83444e
3 changed files with 12 additions and 4 deletions
+1
View File
@@ -1,6 +1,7 @@
server {
listen 80;
server_name localhost;
client_max_body_size 50M;
location /api/ {
proxy_pass http://limelite-api:5000;
+11 -4
View File
@@ -216,7 +216,6 @@ const AnalysisResultPage = () => {
let generatedPdfLink = verificationLink;
if (reportRef.current) {
const reportElement = reportRef.current;
reportElement.style.display = 'block';
try {
const canvas = await html2canvas(reportElement, {
@@ -241,15 +240,21 @@ const AnalysisResultPage = () => {
method: 'POST',
body: fd
});
if (!saveRes.ok) {
throw new Error(`Server returned ${saveRes.status} for PDF upload`);
}
const saveData = await saveRes.json();
if (saveData.success) {
generatedPdfLink = `${API_BASE_URL}${saveData.link}`;
} else {
console.error("Backend failed to save PDF:", saveData);
}
} catch(err) {
console.error("Failed to generate/upload PDF during save:", err);
} finally {
reportElement.style.display = 'none';
alert("PDF Generation/Upload Error: " + err.message);
}
}
@@ -860,7 +865,9 @@ const AnalysisResultPage = () => {
<div
ref={reportRef}
style={{
display: 'none',
position: 'absolute',
top: '-9999px',
left: '-9999px',
width: '210mm',
minHeight: '297mm',
backgroundColor: '#ffffff',