Hello,
I am on the latest 5.1.2, however i noticed when i use https (local hosted domain with selfsigned certificate)
When i try to view PDF invoice it doesn’t show and doesn’t give any errors in laravel.log, however in the browser console i see the following error:
main.dart.js?v=5.1.2:69115 Mixed Content: The page at ‘https://in5.ghf.loc/#/ ’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://in5.ghf.loc/client/invoice/vkwat2u8zu5q59axwmebatiafk3b5yd2/download ’. This request has been blocked; the content must be served over HTTPS.
Respig
February 7, 2021, 6:27pm
2
What is your APP_URL in the .env file? Is it set to https or http?
1 Like
was set to http, now i changed it and it is working. Thanks
1 Like
david
February 8, 2021, 7:45am
4
Self Signed SSL’s do not play well with the Chromium PDF engine unfortunately.
ben
February 8, 2021, 10:10am
5
There’s a flag that’ll tell Chrome to ignore these, not sure if it works.
However, if you want to test it:
Edit vendor/beganovich/snappdf/src/Snappdf.php
After line #137 add: --ignore-certificate-errors
Before:
'--no-margins',
'--no-sandbox',
'--print-to-pdf-no-header',
'--hide-scrollbars',
'--print-to-pdf=' . $pdf,
$content['content'],
];
After:
'--no-margins',
'--no-sandbox',
'--print-to-pdf-no-header',
'--hide-scrollbars',
'--ignore-certificate-errors'
'--print-to-pdf=' . $pdf,
$content['content'],
];
Thanks!
Actually it is working with no issue, and got fixed by changing the URL in the .env file.
2 Likes
Suddenly stopped showing PDF in preview. env is set to http (local hosted domain), installed in docker on qnap. It is shown in design but not from invoices preview.
Inspect errors shows: Access to XMLHttpRequest at ‘http:///client/invoice/kn8RFQWQbAJ6o04vHdyKZA2vnCxZ2kmlnTwmutQvvzRXJaZWzyuHsAr0jaxq25Gi/download’ from origin ‘http://<MY_PC>’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.