html2pdf problem with images

Short story.

If you miss suddenly some pictures at using html2pdf (and some stupid ext of your customer uses a very old version of it) maybe https on server is your problem!

I set a hard forwarding from http:// to https:// in my .htaccess, may you have a look at the best opinion to do that: here.

But now html2pdf ist not able to get pictures via . https:// and falls back to http:// to get the pictures to convert. But the server has now a hard redirect to another adress and so html2pdf does not download the picture, but downloads the forwarding message (http status code).

So i insert an exception to my forwarding rule, by using a RewriteCondition, that all png and jpg files are not affected by the rule.

RewriteCond %{REQUEST_URI} !\.(png|jpg)$
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

My wisdom is just a matter of copy&paste from: StackOverflow.

Autor: Rob Tranquillo

front & backend web coder, social & politics, snow & wakeboard, guitar & bass, vegan & yoga

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit deinem WordPress.com-Konto. Abmelden /  Ändern )

Facebook-Foto

Du kommentierst mit deinem Facebook-Konto. Abmelden /  Ändern )

Verbinde mit %s

%d Bloggern gefällt das: