laurentj / slimerjs

A scriptable browser like PhantomJS, based on Firefox
http://slimerjs.org
Other
3k stars 259 forks source link

is slimerjs beta working with 302 redirect? #687

Open andynuss opened 6 years ago

andynuss commented 6 years ago

versions

Steps to reproduce the issue

I tried two things to get my webappliction to be exercised by slimer beta for FF 57. First, I had a webapp with https absolute urls that pointed to a specific domain. This is how the documents were created. Then I had a second webapp that was identical except for the domain. In slimer, when onResourceRequested encountered the document domain, I was doing a changeUrl to the mirror domain, but with the rest of the url the same. This worked with FF 52 and the lastest release of slimer for linux. But with the beta, all my changeUrls seemed to result in "errcode: 99, desc: an unknown network-related error was detected (2152924148)." By the way, some of the urls were cloudfront proxies of s3 buckets, and some were tomcat servlets, all using the same domain via cloudfront url patterns.

To try to work around the problem, I redesigned my document urls to all be absolute urls to the same domain. This allowed me to eliminate the need for changeUrl at all for the mirror domain, because I made sure to exercise the document using the mirror domain's root url. I tested this redesign successfully with release slimer on FF 52. Then on aws linux 2 with FF 57 and beta slimer, I was no longer getting the "errcode: 99, desc: an unknown network-related error was detected (2152924148)" for all the urls being proxied thru cloudfront to s3 buckets. However, my servlet was still getting these errrors.

What does my servlet do? It simply creates a blob in s3, and the first time it created a blob for a given set of qs params, it servers that binary stream. However, subsequent times, when encountering the same qs params that point to the same effective blob, it does a 302 redirect to the s3 blob using the cloudfront proxy url for that blob. I suspect that this 302 is triggering a problem.

Two notes: the 302 redirect is using an absolute url for the current domain, beginning with /, and not an http absolute url beginning with https://. Also, I don't think bucket write-and-read-visibility latency is a problem, because I saw the similar error when I was doing changeUrl.

Also, the function that sees the error is: _page.onResourceError = function (obj) { console.log('onrsrcerr: url: ' + obj.url + ', errcode: ' + obj.errorCode + ', desc: ' + obj.errorString); }

andynuss commented 6 years ago

Reproduced this problem with rc.1 and FF 57. Will try with rc.1 and FF 58 and FF 59 tomorrow.

andynuss commented 6 years ago

I was mistaken. My redirect works now on rc.1. Looked more carefully at the logs and there were some errcode 99s that were similar, but explained due to the fact that slimer had already been asked for a clean exit.

survtur commented 2 years ago

Did I understand correct, that you only changed version of SlimerJs and problem gone? Or there was something else you did? My SlimerJs 1.0.0 still get same error.