Post by letxobnav » Tue Jun 09, 2020 8:40 am

almost looks like your setting of the session cookie is going in a loop.

also suggest you adjust your cookie settings

; The domain for which the cookie is valid.
; http://php.net/session.cookie-domain
session.cookie_domain = your domain

; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript.
; http://php.net/session.cookie-httponly
session.cookie_httponly = on

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Tue Jun 09, 2020 7:07 pm

until whole solution leave

Code: Select all

$pushImage 	= false;	
next step now set

Code: Select all

$use_cookie = true; 

and some correction of your code

Code: Select all

				// determine cookie domain
				$domain = str_replace('https://','',HTTPS_SERVER);
				$domain = str_replace($subDir,'',$domain);
				$domain = str_replace('www','',$domain);
change to:

Code: Select all

				// determine cookie domain
				$domain = str_replace('https://','',HTTPS_SERVER);
				$domain = str_replace($subDir,'',$domain);
				$domain = str_replace('www.','',$domain);
				$domain = str_replace('/','',$domain);
because .priazha-shop.com/ is not right domain name

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by AndreyPopov » Wed Jun 10, 2020 7:48 am

letxobnav wrote:
Tue Jun 09, 2020 8:40 am
session.cookie_domain = your domain

session.cookie_httponly = on
I cannot access to these settings in hoster control panel
Image

hoster answer: no possibility to set.

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Wed Jun 10, 2020 8:07 am

Poor Host (very slow as well), then you have to set it with each individual statement like:

Code: Select all

setcookie('NAME',$DATA,$EXPIRE,"/"."; SameSite=strict",$DOMAIN,$SECURE,$HTTPONLY);
as in:

Code: Select all

setcookie("h2p", json_encode($pushed_cookie_array), time() + 60 * 60 * 24 * 1, "/".'; SameSite=strict', $domain, true, true);

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Thu Jun 11, 2020 7:01 am

very strange....
set

Code: Select all

$relative 	= true; 
css and js set relative correctly and work.
headers sets

Code: Select all

<catalog/view/theme/journal3/assets/f95d5250a0d8042d17cc7d310c7cf442.css?v=3.0.46>; rel=preload; as=style,<catalog/view/theme/journal3/assets/62fa9ca2cff78f80999ae3d2891dd56b.js?v=3.0.46>; rel=preload; as=script,<catalog/view/theme/journal3/assets/844e066d983585e43f5c8b152e8fc920.js?v=3.0.46>; rel=preload; as=script
but when I try set

Code: Select all

$pushImage 	= true;
images path sets to full path???

Code: Select all

<catalog/view/theme/journal3/assets/f95d5250a0d8042d17cc7d310c7cf442.css?v=3.0.46>; rel=preload; as=style,<catalog/view/theme/journal3/assets/62fa9ca2cff78f80999ae3d2891dd56b.js?v=3.0.46>; rel=preload; as=script,<catalog/view/theme/journal3/assets/844e066d983585e43f5c8b152e8fc920.js?v=3.0.46>; rel=preload; as=script,<https://www.priazha-shop.com/image/catalog/main/priazha1.png>; rel=prefetch; as=image,<https://www.priazha-shop.com/image/cache/catalog/main/priazha-main1a-1812x468.png>; rel=prefetch; as=image,<https://www.priazha-shop.com/image/cache/transparent-70x70.png>; rel=prefetch; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/AlizeLanaGoldFine/alize-lana-gold-fine-583-70x70w.jpg>; rel=prefetch; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/AlizeAngoraGold/alize-angora-gold-01-70x70w.jpg>; rel=prefetch; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/AlizePuffyFur/alize-puffy-fur-6117-70x70.jpg>; rel=prefetch; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/AlizeAngoraGold/alize-angora-gold-339-70x70w.jpg>; rel=prefetch; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/AlizeMissbatik/alize-miss-batik-3713-70x70w.jpg>; rel=prefetch; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/AlizeLanaGoldClassic/alize-lana-gold-classic-44-70x70w.jpg>; rel=prefetch; as=image,<https://www.priazha-shop.com/image/cache/catalog/main/priazha-main1a-150x38fill.png>; rel=prefetch; as=image

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Thu Jun 11, 2020 1:26 pm

yes, you put absolute image paths in your html source.
You can use that variable to make relative paths absolute, not absolute paths relative.
That would give you problems when you use virtual paths sections like language and you do not want to make urls which need to be absolute, relative, visa versa is ok.

Better make your image paths relative, which can be relative, in your html.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Thu Jun 11, 2020 9:06 pm

try on test site (and some strange)
https://www.computersystems.fun
no SEO, no Journal
all push in true.


when

Code: Select all

$use_cookie = false; 
for example https://www.computersystems.fun/index.p ... duct_id=49
in header:

Code: Select all

link: <catalog/view/javascript/bootstrap/css/bootstrap.min.css>; rel=preload; as=style,<catalog/view/javascript/font-awesome/css/font-awesome.min.css>; rel=preload; as=style,<catalog/view/theme/default/stylesheet/stylesheet.css>; rel=preload; as=style,<catalog/view/javascript/jquery/magnific/magnific-popup.css>; rel=preload; as=style,<catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css>; rel=preload; as=style,<catalog/view/javascript/jquery/jquery-2.1.1.min.js>; rel=preload; as=script,<catalog/view/javascript/bootstrap/js/bootstrap.min.js>; rel=preload; as=script,<catalog/view/javascript/jquery/magnific/jquery.magnific-popup.min.js>; rel=preload; as=script,<catalog/view/javascript/jquery/datetimepicker/moment/moment.min.js>; rel=preload; as=script,<catalog/view/javascript/jquery/datetimepicker/moment/moment-with-locales.min.js>; rel=preload; as=script,<catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js>; rel=preload; as=script,<catalog/view/javascript/common.js>; rel=preload; as=script,<https://www.computersystems.fun/image/catalog/cart.png>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_1-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_1-228x228.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_7-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_7-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_6-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_6-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_5-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_5-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_4-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_4-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_3-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_3-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_2-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_2-74x74.jpg>; rel=prefetch; as=image
css - present
js - present
images - present
fonts - absent



when

Code: Select all

$use_cookie = true; 
than

Code: Select all

link: <https://www.computersystems.fun/image/catalog/cart.png>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_1-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_1-228x228.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_7-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_7-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_6-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_6-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_5-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_5-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_4-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_4-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_3-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_3-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_2-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_2-74x74.jpg>; rel=prefetch; as=image
but in error_log:

Code: Select all

<catalog/view/javascript/bootstrap/css/bootstrap.min.css>; rel=preload; as=style,<catalog/view/javascript/font-awesome/css/font-awesome.min.css>; rel=preload; as=style,<catalog/view/theme/default/stylesheet/stylesheet.css>; rel=preload; as=style,<catalog/view/javascript/jquery/magnific/magnific-popup.css>; rel=preload; as=style,<catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css>; rel=preload; as=style,<catalog/view/javascript/jquery/jquery-2.1.1.min.js>; rel=preload; as=script,<catalog/view/javascript/bootstrap/js/bootstrap.min.js>; rel=preload; as=script,<catalog/view/javascript/jquery/magnific/jquery.magnific-popup.min.js>; rel=preload; as=script,<catalog/view/javascript/jquery/datetimepicker/moment/moment.min.js>; rel=preload; as=script,<catalog/view/javascript/jquery/datetimepicker/moment/moment-with-locales.min.js>; rel=preload; as=script,<catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js>; rel=preload; as=script,<catalog/view/javascript/common.js>; rel=preload; as=script,<https://www.computersystems.fun/image/catalog/cart.png>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_1-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_1-228x228.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_7-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_7-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_6-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_6-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_5-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_5-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_4-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_4-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_3-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_3-74x74.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_2-500x500.jpg>; rel=prefetch; as=image,<https://www.computersystems.fun/image/cache/catalog/demo/samsung_tab_2-74x74.jpg>; rel=prefetch; as=image
why?

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Fri Jun 12, 2020 1:17 pm

yes, because you have this:

Code: Select all

error_log(print_r($headersAlls,true));
after this:

Code: Select all

$headersAlls = implode(',',$headersAll);
so it prints all assets it finds.

But with cookie enabled, it will only push the js and css headers once, the cookie tracks if those were send already for that route.
It will still send the image push headers regardless if the always_image_ variable is true for that route.

if you want the error log to reflect what is send or not you should use:

Code: Select all

				if ($push) {
					if ($headersAlls) {
						error_log('Pushing all for route:'.$this->request->get['route'].' -> '.$headersAlls);
						header('Link: '.$headersAlls, false);
					} else {
						error_log('Pushing nothing (no headers) for route:'.$this->request->get['route']);
					}
				} elseif ($always_img) {
					if ($headersImage) {
						$headersImage = array_unique($headersImage);
						$headersImages = implode(',',$headersImage);
						error_log('Pushing images only for route:'.$this->request->get['route'].' -> '.$headersImages);
						header('Link: '.$headersImages, false);
					} else {
						error_log('Pushing NO images only (always_img = false) for route:'.$this->request->get['route']);
					}
				} else {
					error_log('Pushing nothing (nothing to push) for route:'.$this->request->get['route']);
				}
but you can also just look in web developer tools to see the headers.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Fri Jun 12, 2020 4:48 pm

letxobnav wrote:
Fri Jun 12, 2020 1:17 pm
But with cookie enabled, it will only push the js and css headers once, the cookie tracks if those were send already for that route.
no answer for question about fonts.

why no push fonts?

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Fri Jun 12, 2020 5:15 pm

I already answered that:
viewtopic.php?p=790197#p790197

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Fri Jun 12, 2020 5:27 pm

letxobnav wrote:
Fri Jun 12, 2020 5:15 pm
I already answered that:
viewtopic.php?p=790197#p790197
only OpenCart. default theme.
OpenCart from box use fonts or not?

letxobnav wrote:
Fri Jun 12, 2020 1:17 pm
It will still send the image push headers regardless if the always_image_ variable is true for that route.
not whole understanding logics but may be images push twice? first to cookie, second directly to header?

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by AndreyPopov » Wed Jun 17, 2020 6:51 am

css and js push headers work in all wariants,
cookies enabaled and disabled
consolidate push or individual push.

image push not work in any variants :(
even individual link added to header for each image.

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Wed Jun 17, 2020 9:20 am

consolidate push or individual push.
The push track cookie version I posted does not have a consolidate or individual push so what code are you now using?

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Wed Jun 17, 2020 6:41 pm

letxobnav wrote:
Wed Jun 17, 2020 9:20 am
consolidate push or individual push.
The push track cookie version I posted does not have a consolidate or individual push so what code are you now using?
I try and test all possible variants.

I replace

Code: Select all

			if ($headersAlls) header('Link: '.$headersAlls, false);
with this

Code: Select all

		if ($pushCss) {
			$headersCss = array_unique($headersCss);
				foreach($headersCss as $headerCss) header('Link: '.$headerCss, false);
		}
		if ($pushJs) {
			$headersJs = array_unique($headersJs);
				foreach($headersJs as $headerJs) header('Link: '.$headerJs, false);
		}
		if ($pushFont) {
			$headersFont = array_unique($headersFont);
				foreach($headersFont as $headerFont) header('Link: '.$headerFont, false);
		}
		if ($pushImage) {
			$headersImage = array_unique($headersImage);
				foreach($headersImage as $headerImage) header('Link: '.$headerImage, false);
		}
		if ($pushMp3) {
			$headersMp3 = array_unique($headersMp3);
				foreach($headersMp3 as $headerMp3) header('Link: '.$headerMp3, false);
----------------------------------------


may be problem in some incompatibility with Journal theme?

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Wed Jun 17, 2020 10:33 pm

oh, you are experimenting yourself.
That is great, not sure about journal and its caching but you were generating push headers before so I doubt it is that.
You do have a very slow server though or maybe that is because of journal itself and the enormous amount of journal css you put out inline does not help with the speed of the regex trying to find the links in there.
I don't have journal so I don't know how that works, I can only see what its result is.
You also may have to look at nginx and http/2 push:
https://www.nginx.com/blog/nginx-1-13-9 ... matic-push

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by AndreyPopov » Thu Jun 18, 2020 3:18 am

letxobnav wrote:
Wed Jun 17, 2020 10:33 pm
You do have a very slow server though
https://www.priazha-shop.com and https://www.computersystems.fun on same hosting in same account.
two folders on same disk.


read some articles about Server Push.
some authors says that not good idea push all resources.
- first step push css
- second push another and check performance

I have a lot of big high res images on store and may be best way push only css and js?
or may NOT push they?

Code: Select all

Link: </nginx.png>; as=image; rel=preload; nopush

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by AndreyPopov » Thu Jun 18, 2020 11:11 pm

trying push only small png images? not high res jpg.

links in header added, but push not work! why?

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by AndreyPopov » Fri Jun 19, 2020 6:15 pm

change method to preload and push for small png now work

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by AndreyPopov » Fri Jun 19, 2020 10:10 pm

may be problem with many jpg pushes in that:
Nginx
http2_max_concurrent_pushes by default sets to 10?

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by AndreyPopov » Tue Jun 23, 2020 8:07 pm

is a good idea check image size before decide push or not?

not check real size. use pattern.
all images in image cache have in name they file name size

product-name-40x40.jpg
product-name-60x60.jpg
product-name-80x80.jpg
product-name-100x100.jpg
……..
product-name-500x500.jpg
product-name-1000x1000.jpg
…...
product-name-4000x2722.jpg

how filter and try add only 40x40, than try add 60x60 …..

for example:

Code: Select all

if ( strpos($file,'40x40') != false ) { $headersImage[] = '<'.$file.'>; rel='.$method_img.'; as=image';}
????

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am
Who is online

Users browsing this forum: No registered users and 131 guests