【发布时间】:2014-12-19 21:21:01
【问题描述】:
我在 Symfony2 应用程序中使用 Wkhtmltopdf 将一些文件转换为 PDF。事实上,KnpSnappyBundle 确实如此。这个捆绑包很好用,但我有一个奇怪的问题:
Web 应用程序有两个子域:test.domain 和 prod.domain。此时两个子域的内容完全相同。
由于某种原因,使用prod 子域时不会打印图像(转换为 PDF)。但是,如果我直接访问 URL,则图像存在。一个例子是:
<img src="prod.domain/img/theImage.jpg" /> <!-- This doesn't print the image but the URL is accessible -->
<img src="test.domain/img/theImage.jpg" /> <!-- This works right -->
我终于决定暂时使用test 子域图片网址,但这很奇怪……有什么想法吗?
编辑:
我忘了说prod 域使用 SSL,而test 没有。这似乎是主要问题。
我已经从服务器执行了:
wkhtmltopdf https://prod.domain test.pdf
Loading pages (1/5)
QSslSocket: cannot resolve SSLv2_client_method ] 10%
QSslSocket: cannot resolve SSLv2_server_method
Error: Failed loading page https://prod.domain (sometimes it will work just to ignore this error with --ignore-load-errors)
所以我又试了一次:
wkhtmltopdf --ignore-load-errors https://prod.domain test.pdf
Loading pages (1/5)
QSslSocket: cannot resolve SSLv2_client_method ] 10%
QSslSocket: cannot resolve SSLv2_server_method
Warning: Failed loading page https://prod.domain (ignored)
Resolving links (2/5)
Counting pages (3/5)
Printing pages (5/5)
Done
但新文件是银行。
如果我使用test 域(无 SSL):
wkhtmltopdf http://test.domain test.pdf
Loading pages (1/5)
QSslSocket: cannot resolve SSLv2_client_method ] 21%
QSslSocket: cannot resolve SSLv2_server_method
Resolving links (2/5)
Counting pages (3/5)
Printing pages (5/5)
Done
我遇到了前两个错误,但它可以正常工作并且文件是正确的。
【问题讨论】:
标签: symfony subdomain wkhtmltopdf