Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Better support for HTTPS websites #66

Open
slorber opened this issue Dec 11, 2014 · 7 comments
Open

Better support for HTTPS websites #66

slorber opened this issue Dec 11, 2014 · 7 comments

Comments

slorber added a commit to slorber/screenshot-as-a-service that referenced this issue Dec 11, 2014
@slorber
Copy link
Author

slorber commented Dec 11, 2014

Note the pull request solves your TODO Allow to configure phantomjs options through YAML config

@mikej165
Copy link

mikej165 commented Jan 3, 2015

I generate about 20,000 screenshots a day and was having a problem with some of the sites that were using https-hosted images. Applying the --ssl-protocol=any option completely resolved it.

@PS-HaejinChoi
Copy link

mikej165,

Per your comment above, I created the file called development.yaml under the config folder, and
wrote as follow:

rasterizer:
command: 'phantomjs ----ssl-protocol=any'

But it fails to run with the following error message:
[uncaughtException] { [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' }

It would be greatly appreciated if you could share where and how you've added the Phantom options above.

@mikej165
Copy link

Have you tried using the full path to the binary. i.e. /usr/bin/phantomjs?

@slorber
Copy link
Author

slorber commented Jan 24, 2015

@mspoodle the current code does not permit to pass options imho, this is why I made a fork/PR

With my fork, the option is automatically included by default and is not part of the command attribute but a new option attribute.
See
https://github.com/slorber/screenshot-as-a-service/blob/master/config/default.yaml

See also the related diff:
slorber@eb5aa54

When passing options to phantomJS, I discovered that these options must be passed at the beginning.
I mean phantomjs options xxx.js works, but not phantomjs xxx.js options (as far as I remember).

The original code before my PR is

spawn(this.config.command, ['scripts/rasterizer.js', this.config.path, this.config.port, this.config.viewport]);

I have also tried to use the command: 'phantomjs ----ssl-protocol=any' but it did not work,

It seems you can't call: spawn("phantomjs option1 option2", ['scripts/rasterizer.js', ...])

But instead you can call: spawn("phantomjs", ['option1","option2","scripts/rasterizer.js', ...])

I'm a node beginner and never used spawn before but this is what I noticed, and this is what my fork fixes

Maybe @fzaninotto will merge it soon

@PS-HaejinChoi
Copy link

Thank you @slorber and @mikej165 for the suggestions.

I will try them and see how that works.

@PS-HaejinChoi
Copy link

@slorber Your solution worked like a charm. Thank you so much.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants