Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

--ignore-ssl-errors not working #12181

Closed
thoop opened this issue Apr 27, 2014 · 51 comments
Closed

--ignore-ssl-errors not working #12181

thoop opened this issue Apr 27, 2014 · 51 comments
Assignees

Comments

@thoop
Copy link

thoop commented Apr 27, 2014

I'm having a problem where I'm seeing "SSL handshake failed" only on my AWS EC2 instance, even though I'm using --ignore-ssl-errors=true. The weird part is it ONLY happens on my EC2 instance for this one website, and it works locally. I'm also using --ssl-protocol=tlsv1 and their website is using SNI with AWS Cloudfront. Both my EC2 instance and my local machine are on PhantomJS 1.9.7.

I've tried everything like making sure openssl and ca-certificates are up to date, making sure we have their correct cert, making sure curling their site works, and pointing phantomjs to the certificates directory.

Here's some of my --debug=true output:

getting https://learni.st
phantom stderr: 2014-04-27T06:18:25 [DEBUG] WebPage - updateLoadingProgress: 10 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] Network - SSL Error: "No error" 
2014-04-27T06:18:25 [DEBUG] Network - SSL Error: "No error" 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] CookieJar - Saved "AWSELB=77C1F30691E24C3635F1BC72711A62B209E042A855CCD8B001F19C9CB6DBDF2F79067F1DA44C89C0961A758EBC0211B52B5FCE241033BBB205D68C8891EAEEC1E94E1F71; domain=learni.st; path=/" 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] WebPage - updateLoadingProgress: 11 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] Network - Resource request error: 6 ( "SSL handshake failed" ) URL: "https://assets2.learni.st/spa/css/vendor-9e306212.css" 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] Network - Resource request error: 6 ( "SSL handshake failed" ) URL: "https://assets1.learni.st/spa/css/app-0ee007ab.css" 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] Network - Resource request error: 6 ( "SSL handshake failed" ) URL: "https://assets1.learni.st/spa/js/app-a16957cd.js" 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] Network - Resource request error: 6 ( "SSL handshake failed" ) URL: "https://assets2.learni.st/spa/js/vendor-35e66510.js" 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] Network - Resource request error: 6 ( "SSL handshake failed" ) URL: "https://assets0.learni.st/spa/js/select2.min-16f03230.js" 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] Network - Resource request error: 6 ( "SSL handshake failed" ) URL: "https://assets3.learni.st/spa/js/templates-11af8771.js" 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] WebPage - updateLoadingProgress: 25 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] WebPage - setupFrame "" 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] WebPage - updateLoadingProgress: 100 

phantom stderr: 2014-04-27T06:18:25 [DEBUG] WebPage - setupFrame ""
...

The weird part is the SSL Error: "No error" on the homepage. That page loads just fine and calls onResourceReceived, but the subsequent requests don't load and call the onResourceError function.

Isn't --ignore-ssl-errors=true supposed to keep those SSL handshake errors from happening?

@vitallium
Copy link
Collaborator

The option --ignore-ssl-errors=true doesn't force PhantomJS to use ANY secure layer (SSL or TLS), i.e. PhantomJS will use SSLv3 with this option.
But, I agree with you, this option must tell PhantomJS to use any available protocol.

@vitallium vitallium self-assigned this Apr 27, 2014
@vitallium vitallium added this to the FutureRelease milestone Apr 27, 2014
@thoop
Copy link
Author

thoop commented Apr 27, 2014

Thanks @vitallium

Do you have any idea why --ignore-ssl-errors=true is not working since it's failing on SSL errors? Taking out --ssl-protocol=tlsv1 makes it fail locally with the same errors as above.

All I'm passing in is --load-images=false and --ignore-ssl-errors=true, and getting SSL handshake errors.

@vitallium
Copy link
Collaborator

You need to combine these two options, then this web site will work. PhantomJS uses SSLv3 by default for all secure connections.

@thoop
Copy link
Author

thoop commented Apr 27, 2014

Oh, the error log from my first post is from using both --ignore-ssl-errors=true and --ssl-protocol=tlsv1 combined. And it's still giving the SSL error on my EC2 instance. If I ps aux | grep phantomjs I can see both arguments being passed in.

@thoop
Copy link
Author

thoop commented Apr 29, 2014

@vitallium I saw that you added some labels to this issue. Were you able to reproduce the errors?

@vitallium
Copy link
Collaborator

@thoop no. I can open this website by combining two options.

@thoop
Copy link
Author

thoop commented Apr 30, 2014

Would you like me to set up and give you access to an AWS machine with phantomjs set up on it to test with? How can I work with you to reproduce this to see what's going on? I doubt the log dump from above is enough to help you fix it without being able to reproduce it.

Just let me know how I can help.

@HasseM
Copy link

HasseM commented May 7, 2014

Got the same problem... SSL handshake failed but commandline option --ignore-ssl-errors=true and also I got --web-security=false and still got a cross domain origin error..... looks like command line options are not working... or at least some of them.

@vitallium
Copy link
Collaborator

@HasseM do you have an example?

@HasseM
Copy link

HasseM commented May 7, 2014

@vitallium, yes but my code is a big mess now due to my debugging... let me take out the Access-Cotrol-Allow-Origin with --web-security=false.

script.js:
var page = require('webpage').create();

res = phantom.injectJs("jquery.js");

$.get("http://www.nu.nl/",
{},
function(data) {
Logg("Got index page.");
phantom.exit();
}
);

started on Ubuntu64 with:
phantomjs --web-security=false script.js

result:
XMLHttpRequest cannot load http://www.nu.nl/. Origin file:// is not allowed by Access-Control-Allow-Origin.

Strange... with websucurity disabed, this should work...

for the SSL error I have no ready example to post here... but its exactly like in the first post here.

@vitallium
Copy link
Collaborator

Oh, --web-security option doesn't work for PhantomJS's execution context. I have the patch for that, but it requires some tests before it will be landed to the master.
This is an another issue :-) See #11217

@HasseM
Copy link

HasseM commented May 7, 2014

For the SSL error, I got the error message "SSL handshake failed" and the option --ignore-ssl-errors=true did not fix this.... What debug info do you need from me?

@vitallium
Copy link
Collaborator

Like I said before, option --web-security doesn't work in the PhantomJS's execution context. So, you will have errors all the time.

@HasseM
Copy link

HasseM commented May 7, 2014

edited my previous post, wrong option....

Also I got rid of the SSL error by specifying --ssl-protocol=tlsv1

@thoop
Copy link
Author

thoop commented May 15, 2014

I have both --ignore-ssl-errors=true and --ssl-protocol=tlsv1 set and I still get the error only on my AWS EC2 machines.

@saarthakvats
Copy link

I am also facing this issue :( This is happening for me for a page which tries to fetch a JS file from a HTTPS CDN. I tried -ignore-ssl-errors=true, --ssl-protocol=tlsv1, --web-security=no ... nothing worked.
However, if I make the script src protocol as http, it loads the resource in the page and I can see the resource being successfully loaded from "page.onResourceReceived" callback, but I need to have the JS loading from HTTPS, any help in this direction would be greatly appreciated.

@thoop
Copy link
Author

thoop commented Sep 25, 2014

This works fine in PhantomJS 2. It seems that PhantomJS 1 has some problems with SNI.

@LeCoupa
Copy link

LeCoupa commented Oct 17, 2014

The option --ignore-ssl-errors=true doesn't force PhantomJS to use ANY secure layer (SSL or TLS), i.e. PhantomJS will use SSLv3 with this option.

Is it smart with the POODLE Bug? (just wondering)

@adamgotterer
Copy link

@saarthakvats did you ever figure out how to get this to work with https?

@herlon214
Copy link

herlon214 commented Sep 27, 2016

--ignore-ssl-errors=true --ssl-protocol=any worked for me 1.9.2

@vitallium
Copy link
Collaborator

Fixed in 2.5 beta

@arunchandramouli
Copy link

I am using python and phantomjs driver to crawl google careers - https://www.careers.google.com
I tried in the service_args = ['--ignore-ssl-errors=yes','--ignore-ssl-errors=true','--ssl-protocl=any']
Phantomjs version 2.0.0

@arunchandramouli
Copy link

But it always renders about:blank

@cardiner
Copy link

cardiner commented Feb 20, 2017

Having the same problem as @arunchandramouli. phantomjs --ignore-ssl-errors=true --ssl-protocol=any --debug=true but renders blank page. Works fine on dev environment where ssl is not enabled. production servers renders blank pages. Running on heroku.

debug output.

2017-02-20T09:39:06 [DEBUG] Network - Resource request error: 6 ( "SSL handshake failed" ) URL: "https://mysite.com/image_placeholders?page_uuid=03aaa2ee-7f16-4fa2-8609-20bcb50576c1"

@amarynets
Copy link

I have the same problem as @cardiner and @arunchandramouli
I use this way for configure PhantomJS for my Python code:
`webdriver.DesiredCapabilities.PHANTOMJS['phantomjs.page.settings.userAgent'] = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36'

webdriver.DesiredCapabilities.PHANTOMJS['phantomjs.page.settings.load-images'] = True
webdriver.DesiredCapabilities.PHANTOMJS['phantomjs.page.settings.ignore-ssl-errors'] = True
webdriver.DesiredCapabilities.PHANTOMJS['phantomjs.page.settings.ssl-protocl'] = 'any'`

@shubhamj-cuelogic
Copy link

I am facing the same issue. Below code working fine in windows where it is also executing the https but in Ubuntu I am getting same error for https. it is working fine for http

I am using the below code

DesiredCapabilities capabilities = null;
ArrayList cliArgsCap = new ArrayList();
capabilities = DesiredCapabilities.phantomjs();
cliArgsCap.add("--web-security=false");
cliArgsCap.add("--ssl-protocol=any");
cliArgsCap.add("--ignore-ssl-errors=true");
capabilities.setCapability("takesScreenshot", true);
capabilities.setJavascriptEnabled(true);
capabilities.setCapability(
PhantomJSDriverService.PHANTOMJS_CLI_ARGS, cliArgsCap);
capabilities.setCapability(
PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_CLI_ARGS,
new String[] { "--logLevel=2" });

@luispeerez
Copy link

Same here, getting the SSL handshake error using the 2.1.15 version. I am using

--ignore-ssl-errors=true --ssl-protocol=any

@verishal
Copy link

verishal commented Oct 13, 2017

I am using angular js and phantomjs driver to crawl google careers - https://example.com
I tried in the service_args = ['--ignore-ssl-errors=yes','--ignore-ssl-errors=true','--ssl-protocl=any']
Phantomjs version 2.1.1.
I tried in the service_args ,but is same ssl error. google crawl not accept the https://example.com/?_escaped_fragment_= request,In https but it still working in http.Like http://example.com/?_escaped_fragment_= .i don't understand why not take request https ?
please help me...

when i request the service_args:

    phantomjs --disk-cache=no  --ignore-ssl-errors=yes --ignore-ssl-errors=true --ssl-protocol=any /opt/bitnami/apache-tomcat/stt/ROOT/js/angular-seo.js 9090 https://example.com/

@luispeerez
Copy link

I had problems with this, unti I figured it out that my SSL Certificate from Comodo was wrongly configured, I followed this tutorial https://www.namecheap.com/support/knowledgebase/article.aspx/9419//installing-a-certificate-on-nginx and now it works ok :)

@verishal
Copy link

Hello luispeerez. I followed this tutorial https://www.namecheap.com/support/knowledgebase/article.aspx/9419//installing-a-certificate-on-nginx .but not working .

@luispeerez
Copy link

@verishal your certificate is from comodo?

@verishal
Copy link

verishal commented Nov 4, 2017

No.because I get certificate from SSL4.

@sfantu
Copy link

sfantu commented Nov 5, 2017

Also facing this problem.
The page is blank.

@verishal
Copy link

verishal commented Nov 6, 2017

sfantu.Do you have some idea?

@Naveenkv93
Copy link

Naveenkv93 commented Dec 7, 2017

Page is navigating to about:blank. Tried all the combination mentioned above with SSL, but nothing worked. Exactly same issue as @shubhamj-cuelogic mentioned

@pushplataranjan
Copy link

phantomjs --web-security=false --ignore-ssl-errors=true scripts.js

@verishal
Copy link

verishal commented Apr 11, 2022 via email

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