Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setCookie script does not work with https #844

Closed
a701440 opened this issue Mar 10, 2017 · 12 comments
Closed

setCookie script does not work with https #844

a701440 opened this issue Mar 10, 2017 · 12 comments
Labels

Comments

@a701440
Copy link

a701440 commented Mar 10, 2017

With Chrome use a script to set cookie on a https url and then navigate to the https url. The request headers do not contain the requested cookie. When using http urls it does work.

@tylergraf
Copy link

@a701440 Can you post an example script? Also what location and device are you selecting?

@mverkerk-godaddy
Copy link
Contributor

I have reported this too (see https://www.webpagetest.org/forums/showthread.php?tid=14844) but unfortunately I can't share my script due to sensitive data. My input here is (a) i noticed it after updating to agent version 371 and (b) it also happens on our local instance so not location/device specific ...

@JavRok
Copy link

JavRok commented Apr 26, 2017

Hi, I just discovered that the problem is happening only in Firefox. Here are two exact tests with scripting, setting a cookie to remove the cookie bar (on the top of the screenshot):

You can see the setCookie worked on Chrome but not on Firefox.

I see something different, though, if I use the API (npm), but it also fails. I think this functionality needs to be reviewed with the update.

Thanks

@stephendonner
Copy link
Contributor

I hit this too, and here's what I've found:

1.Without entering a website URL at the top "Enter a Website URL," but instead, you paste the following into the "Script" tab on https://www.webpagetest.org/ (or your instance), the cookie won't get set in Firefox[0]:

setCookie https://addons-dev.allizom.org mamo=on
navigate https://addons-dev.allizom.org

2.If, instead (still specifying Firefox), you type in https://addons-dev.allizom.org into the "Enter a Website URL" textfield, and then use the "Advanced" tab and under "Custom Headers" to insert the following:

Cookie: mamo=on

It works[1]

3.Specifying Chrome, without entering the URL into "Enter a Website URL," but just entering the same script from 1:

setCookie https://addons-dev.allizom.org mamo=on
navigate https://addons-dev.allizom.org

It works[2]

[0] https://www.webpagetest.org/result/170809_43_1Z6V/
[1] https://www.webpagetest.org/result/170809_QJ_1ZR2/
[2] https://webpagetest.org/result/170809_3H_20B0/

@stephendonner
Copy link
Contributor

@pmeenan @digitarald are you able to confirm, help diagnose why? Thanks!

@pmeenan
Copy link
Contributor

pmeenan commented Aug 10, 2017

Setting a cookie goes down a different code path than adding headers. Adding headers is supported by the webRequest extension support. I'm not sure if the ability to set cookies was wired up in the move to the new extension. At a minimum I can alias the setCookie command to add the cookie header instead in the Firefox case but that may break cases where other cookies are set during the session.

@pmeenan
Copy link
Contributor

pmeenan commented Aug 10, 2017

FWIW, looks like it need to be hooked up to this.

@stephendonner
Copy link
Contributor

Thanks, @pmeenan - In case it helps others, a workaround for Firefox is to do something like: stephendonner/webpagetest-amo@73f6e66 which uses addHeader (you can also use setHeader) to set a cookie with the appropriate value(s).

@avandonkelaar
Copy link

On our private instance we have the same issue on chrome. The cookie is not added. The same issue persists with using the AddHeader function. https://www.webpagetest.org/results.php?test=171124_4F_3c505e68a9a6d86d4d0428c6131be148

@kazazor
Copy link

kazazor commented Dec 28, 2018

@stephendonner
I can also report that using Chrome with the setCookie option does not work for me.
It does work using the custom headers options, but only for the first view. The repeat view is broken.

Is there any idea how to resolve it / a fix that is coming?

@caiql
Copy link

caiql commented Apr 8, 2019

@kazazor I have the same problem,and I don't known how to fix it.
@stephendonner Is there any idea how to resolve it / a fix that is coming?

@github-actions
Copy link

We're in the process of cleaning up issues on this project in order to ensure we're able to stay on top of high priority bugs and feature requests. As a part of this process, we're automatically closing any issues that have had no activity within the last two years, including this one, since the codebase has changed dramatically in that time. If you feel this is still relevant, please file a new issue using the relevant issue template so we can get it prioritized. Thanks!

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

No branches or pull requests

10 participants