Claude Posted May 31, 2020 Posted May 31, 2020 (edited) HelloDoes it make sense to create a subdomain like “static.mydomain.com” in order to define the domain of cookies?Should I then add in the constants.php file the following 3 constants, namely: - \define ('COOKIE_DOMAIN', 'https://static.mydomain.com');- \define ('COOKIE_PREFIX', 'prefix_');- \define ('COOKIE_PATH', '/'); I'm not sure if these are the correct lines to insert into the constants file!Thank you in advance,Regards,Claude Edited May 31, 2020 by Claude
Rhett Posted May 31, 2020 Posted May 31, 2020 short answer: No What problem are you having that you are trying to solve?
Claude Posted May 31, 2020 Author Posted May 31, 2020 6 minutes ago, Rhett said: short answer: No What problem are you having that you are trying to solve? Hello Rhett, I would like to avoid unnecessary cookie traffic and serve static content from a different domain. Thanks Rhett Claude
Rhett Posted May 31, 2020 Posted May 31, 2020 1 hour ago, Claude said: Hello Rhett, I would like to avoid unnecessary cookie traffic and serve static content from a different domain. Thanks Rhett Claude Can you again please clarify what problem you are trying to solve with this? Are you simply trying to trick/mask speed test sites to obtain a better results or are you actually having an issue that you are trying to correct?
Claude Posted May 31, 2020 Author Posted May 31, 2020 I'm just trying to fix the errors encountered on GTmetrix regarding the speed test to get better results. Thanks Rhett
Rhett Posted May 31, 2020 Posted May 31, 2020 7 minutes ago, Claude said: I'm just trying to fix the errors encountered on GTmetrix regarding the speed test to get better results. Thanks Rhett You would not be fixing anything in that case, just tricking the test site to think it's better, it would have no real world impact. I wouldn't waste your time with this honestly, all this does is trick the test site into producing a better score, it has no impact on real world performance. (actual usage) If this actually made a difference in performance it would be included in the core with settings and options for this.
bfarber Posted June 1, 2020 Posted June 1, 2020 You're approaching this backwards. Firstly, this is invalid: \define ('COOKIE_DOMAIN', 'https://static.mydomain.com'); You enter a domain, not a fully qualified URL. So something like "static.mydomain.com". BUT, that would break your site entirely - it would tell browsers to only set and read the cookie from the domain you entered (which wouldn't work because the primary domain would be trying to set and read the cookies). What the test suite you are using is recommending is to store your images and other static assets somewhere like "static.separatedomain.com" and serve the files from there, without changing how cookies work on your main domain. You can already do this by using the built in S3 integration in the AdminCP under System > Files > Storage Settings.
Recommended Posts