If you run stage locally - everything works fine and photos are displayed in PDF.
BUT if you are running your server with Apache mod_proxy:
ProxyRequests Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode
ProxyPass / http://localhost:9009/ nocanon
ProxyPassReverse / http://localhost:9009/
then even if: final String host = routes.HomeController.index().absoluteURL(request()); points correctly to https://myhost.io, PDF is generated but no photos are displayed, nor exception is thrown.
It just fails silently!
Workaround that I found after hours of investigation is that you must use http://localhost:9009 for both:
// final String host = routes.HomeController.index().absoluteURL(request());
final String host = "http://localhost:9009";
Let's say we have a template:
and we use it like this:
and - what is important - our
application.conf
looks like this:If you run
stage
locally - everything works fine and photos are displayed in PDF. BUT if you are running your server with Apache mod_proxy:then even if:
final String host = routes.HomeController.index().absoluteURL(request());
points correctly tohttps://myhost.io
, PDF is generated but no photos are displayed, nor exception is thrown. It just fails silently!Workaround that I found after hours of investigation is that you must use
http://localhost:9009
for both:and
Why
play2-pdf
reads photos fromlocalhost:9009
even though I'm pointing it specifically tomyhost.io
?