Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Requests from PhantomJS being blocked
We have an application which generates Images and PDFs from rendered HTML using PhantomJS. This is running on an nginx server.
The HTML files are saved on the same server as the application and these are requested by the headless browser inside PhantomJS.
This set up was all working perfectly for about 3 weeks when suddenly the Images and PDFs started coming back blank (black background with small blue squares where the images should be).
At first I thought the issue was related to internal DNS - the HTML file is passed to PhantomJS as a path but all the css and images are loaded in to the HTML over URLS. If I changed these URLs to point to another domain (not Digital Ocean) I could get the PDF to render. If I moved all the CSS to be inline in the HTML file it would also render (albeit without images), but no http request made by PhantomJS to the Digital Ocean server seemed to resolve.
I then tried to load one of the rendered HTML files stored on the Digital Ocean server into a PhantomJS set up hosted on a different server (again, not Digital Ocean). In this case the HTML was passed as a URL and this initial request was blocked - the PhantomJS process just hung.
It certainly seems as though Digital Ocean has started blocking all requests from PhantomJS. Perhaps these requests are being considered malicious and have triggered some security measure.
I saw this post which referred to something similar: https://www.digitalocean.com/community/questions/can-digitalocean-block-incoming-http-request
Can anyone suggest anyway to test the theory and hopefully get these requests unblocked?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×