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

try on my main site https://www.priazha-shop.com - some problem exist with SEO urls

404 errors or 503 errors from LiteSpeed.

but some pages answer and with push headers.


may be problem also in Journal that also add to response.php:

Code: Select all

	public function output() {
		if ($this->output) {

                if (defined('JOURNAL3_ACTIVE')) {
                    if (\Journal3::getInstance()->settings->get('performanceHTMLMinify')) {
                        $this->output = \Journal3\Minifier::minifyHTML($this->output);
                    }

                    if (\Journal3::getInstance()->settings->get('performanceJSDefer')) {
                        $this->output = str_replace('<script type="text/javascript">', '<script type="text/javascript/defer">', $this->output);
                    }
                }

			$output = $this->level ? $this->compress($this->output, $this->level) : $this->output;

			if (!headers_sent()) {
				foreach ($this->headers as $header) {
					header($header, true);
				}
			}

			echo $output;

                if (defined('JOURNAL3_ACTIVE')) {
                    \Journal3::getInstance()->loadController('journal3/admin_bar');
                }

		}
	}

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Fri Jun 05, 2020 6:56 pm

no, that is just journal output minify, adding defer to javascript and compression stuff which is fine.
as long as you put the push code before:

Code: Select all

$output = $this->level ? $this->compress($this->output, $this->level) : $this->output;
it should be no problem, the push code does not change the output, it just extracts the static assets urls from it to define 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 05, 2020 7:58 pm

letxobnav wrote:
Fri Jun 05, 2020 6:56 pm
no, that is just journal output minify, adding defer to javascript and compression stuff which is fine.
as long as you put the push code before:

Code: Select all

$output = $this->level ? $this->compress($this->output, $this->level) : $this->output;
it should be no problem, the push code does not change the output, it just extracts the static assets urls from it to define the headers.
I try add code between Journal code and $output = $this->level - than all pages except home 503 errors

when try add between if ($this->output) { and Journal code - than:
- some pages 404 errors
- some pages 503 errors
- but some pages load correctly with link: in header

in what place better add

Code: Select all

       	public function __construct($registry) {
			$this->request = $registry->get('request');
		}
I add before public function addHeader($header) {

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Fri Jun 05, 2020 9:10 pm

Well, I cannot see it from here so you will have to make some screen shots with web developer to explain which pages do what.
You can also add:

Code: Select all

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

Code: Select all

$headersAlls = implode(',',$headersAll);
so you can see in your php error log what headers are created and check if the urls of those assets js,css,images are correct.

Might also be a memory problem as you html output created by journal is approx. 1.4MB with all the inline css that template spits out, which has to be loaded and read, mine is approx. 120KB. So maybe also check your error logs for any references there.

That __construct function you can put anywhere, it's a standard function which is called the moment the class is constructed, the proper way to pass variables to the class and initialize variables upon object creation.

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 05, 2020 9:55 pm

letxobnav wrote:
Fri Jun 05, 2020 9:10 pm

Might also be a memory problem as you html output created by journal is approx. 1.4MB with all the inline css that template spits out, which has to be loaded and read, mine is approx. 120KB. So maybe also check your error logs for any references there.
1GB for php available on hosting.

inline css disabled in Journal settings.

add errors_log and check.

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by AndreyPopov » Sat Jun 06, 2020 7:52 am

work but with some issues.

if browser contain previously saved cookies than 503 error (server busy)

is page with complex query like category ( for example https://www.priazha-shop.com/alize-catalog, time to load more then 5s ) than 404 error

P.S. now remove mod until find how to solve issues.

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by AndreyPopov » Sat Jun 06, 2020 8:58 pm

found log on hoster control

many many headers like this

Code: Select all

<catalog/view/theme/journal3/assets/bd1296f14c9084df8766eeed014f7850.css?v=3.0.46>; rel=preload; as=style,<catalog/view/theme/journal3/assets/328d25eef6dbef7259aebafaddb62ee0.js?v=3.0.46>; rel=preload; as=script,<catalog/view/theme/journal3/assets/48680c15ff04c5c849a3e662b272e309.js?v=3.0.46>; rel=preload; as=script,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-751-550x550w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-748-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-746-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-741-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-771-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-759-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-769-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-744-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-770-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-765-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-745-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-758-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-775-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-750-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-776-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-749-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-764-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-774-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-761-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-754-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-773-190x190w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/YarnArtDolce/yarnart-dolce-751-70x70w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/AlizeLanaGoldFine/alize-lana-gold-fine-583-70x70w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/AlizeAngoraGold/alize-angora-gold-01-70x70w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/AlizePuffyFur/alize-puffy-fur-6117-70x70.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/AlizeAngoraGold/alize-angora-gold-339-70x70w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/AlizeMissbatik/alize-miss-batik-3713-70x70w.jpg>; rel=preload; as=image,<https://www.priazha-shop.com/image/cache/catalog/products/AlizeLanaGoldClassic/alize-lana-gold-classic-44-70x70w.jpg>; rel=preload; as=image

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Sat Jun 06, 2020 10:14 pm

well, the headers look fine.

sounds like your server cannot handle the traffic or it takes too long to process the huge html source you are sending out or both.
maybe try not pushing audio as you do not have mp3 and fonts as you use external google fonts anyway:

Code: Select all

	// Which assets to push
	$pushCss 	= true;
	$pushJs 	= true;
	$pushFont 	= false;
	$pushImage	= true;
	$pushMp3 	= false;

and set the push method for images to prefetch instead of preload:

Code: Select all

	// push methods per asset
	$method_img 	= 'prefetch';
	$method_font 	= 'preload';
	$method_css 	= 'preload';
	$method_js 		= 'preload';
	$method_mp3 	= 'prefetch';

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 letxobnav » Sat Jun 06, 2020 10:26 pm

Also consider making your links relative, with many links saves a lot of html source code.
(except for the links in the header that is.)

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 » Sat Jun 06, 2020 11:42 pm

letxobnav wrote:
Sat Jun 06, 2020 10:26 pm
Also consider making your links relative, with many links saves a lot of html source code.
(except for the links in the header that is.)
please help with this. where I can make links relative?
is this right way?

letxobnav wrote:
Sat Jun 06, 2020 10:14 pm

maybe try not pushing audio as you do not have mp3 and fonts as you use external google fonts anyway:

and set the push method for images to prefetch instead of preload:
ok. try tonight

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Sun Jun 07, 2020 12:54 am

please help with this. where I can make links relative?
is this right way?
no, almost, well just no.
You can make links relative that way but you should not make all links relative.
links in external references like meta data (og references, base href, hreflang), emails, google sitemap for example need to be absolute.
So you need to steer that function with a parameter on when to return relative and when absolute and that needs a little more than what was stated there in order to cover seo urls.

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 » Sun Jun 07, 2020 10:35 pm

letxobnav wrote:
Sun Jun 07, 2020 12:54 am
So you need to steer that function with a parameter on when to return relative and when absolute and that needs a little more than what was stated there in order to cover seo urls.
for this time sets

Code: Select all

$relative = false;
when another code will work without problem then try with true.




some questions about this code:

Code: Select all

if (!isset($_COOKIE['h2p'])) {

$pushed_cookie_array = json_decode($_COOKIE['h2p'],true);

setcookie("h2p", json_encode($pushed_cookie_array), time() + 60 * 60 * 24 * 1, "/", $domain, true);
I cannot see in my variables any h2p for cookies or $_COOKIE['h2p']

only

Code: Select all

$_COOKIE['OCSESSIDPR']
$_COOKIE['_ga']
$_COOKIE['n-e0d3c1b5']
$_COOKIE['_gid']	
$_COOKIE['language']	
$_COOKIE['currency']	
$_COOKIE['PHPSESSID']
$_COOKIE['jrv']
$_COOKIE['__atuvc']
$_COOKIE['_gat_gtag_UA_143891158_1']
if I correct understanding - $_COOKIE['h2p'] cookies for HTTP/2 Protocol?
Last edited by straightlight on Sun Jun 07, 2020 11:02 pm, edited 2 times in total.
Reason: Please use the code tags!

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Mon Jun 08, 2020 12:26 pm

the h2p cookie is there to store the array which keeps track of which route was already pushed.

Code: Select all

	$pushed_cookie_array = array(
			'ro' => 0,
			'ca' => 0,
			'pr' => 0,
			'se' => 0,
			'in' => 0,
			'ot' => 0
			);

and it is used when you set it so:

Code: Select all

	$use_cookie 	= true; 	// use cookies to limit pushes already pushed

for instance; if you already pushed the assets (js,css,font,mp3,img) for root (homepage), it will set 'ro' to 1 and not push the assets again when root is requested.
The images will still be pushed if you set $push_img_always_ro to true.

without that cookie, there is no tracking and all enabled push headers will be pushed every time.

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 » Mon Jun 08, 2020 7:21 pm

detailed report.

add mod and first sets:

Code: Select all

	$pushCss 	= false;		// push css assets
	$pushJs 	= false;		// push javascript assets
	$pushFont 	= false;		// push font assets
	$pushImage 	= false;		// push image assets
	$pushMp3 	= false;		// push audio assets

Code: Select all

	$use_cookie = false; 	// use cookies to limit pushes already pushed
	$relative 	= false; 	// use relative urls
	$subDir 	= ''; 		// sub-directory from domain if you use it

Code: Select all

	// always push images for route
	$always_image_root 			= false;
	$always_image_root_query	= false;
	$always_image_category 		= false;
	$always_image_product 		= false;
	$always_image_search 		= false;
	$always_image_information 	= false;
	$always_image_other 		= false;
check site work. work like as usual.

and step by step change settings.

1.

Code: Select all

	$pushImage 	= true;		// push image assets
$method_img 	= 'prefetch';
link to headers added
most pages work correctly
but big category like https://www.priazha-shop.com/alize-catalog and https://www.priazha-shop.com/yarnart-catalog give 404 errors :(

1a.

Code: Select all

	$pushImage 	= true;		// push image assets
$method_img 	= 'preload';
link to headers added
but all pages become 503 error (Server busy) :(

revert to

Code: Select all

	$pushImage 	= false;		// push image assets
$method_img 	= 'prefetch';
2.

Code: Select all

$pushCss 	= true;		// push css assets
link to headers added
all work correctly

3.

Code: Select all

$pushJs 	= true;		// push javascript assets
link to headers added
all work correctly

4.

Code: Select all

$pushFont 	= false;		// push font assets
link to headers not added
all work correctly

why fonts not added to header?
Image
- because incorrect file names and extentions? like icomoon.ttf?gzj9ot?
- or because font used by js script that already pushed?



any ideas what to do with 1 and 4?

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Mon Jun 08, 2020 9:23 pm

look in your source of the html you send, no ttf or woff files there, they may be referenced via js or css like with fontawesome or external links to google.
The code cannot see those as it can only read the html before it is send out.
Best way is to statically push those fonts.

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 » Mon Jun 08, 2020 9:44 pm

letxobnav wrote:
Mon Jun 08, 2020 9:23 pm
look in your source of the html you send, no ttf or woff files there, they may be referenced via js or css like with fontawesome or external links to google.
The code cannot see those as it can only read the html before it is send out.
Best way is to statically push those fonts.
icomoon.ttf (icons for menu) is part of Journal theme and placed on my hosting.
I don't know how push it statically. be learning how to


but more important question about push images.
any ideas what check or set to use correctly push images?

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by letxobnav » Mon Jun 08, 2020 10:08 pm

statically pushing fonts:

after:

Code: Select all

		$pushed_cookie_array = array(
add:

Code: Select all

			'ft' => 0,
after:

Code: Select all

		$pushed_cookie_array = json_decode($_COOKIE['h2p'],true);
	}
add:

Code: Select all

	/****** statically push fonts separate as they may be inside css but only push once ****/
	if (!$pushed_cookie_array['ft']) {
		$font_pushes = array();
		$font_pushes[] = "</co/catalog/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.woff2>; rel=".$method_font."; as=font; crossorigin type=\"font/woff2\"";
		$font_pushes[] = "</co/catalog/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.woff>; rel=".$method_font."; as=font; crossorigin type=\"font/woff\"";
		$font_pushes[] = "</co/catalog/view/javascript/bootstrap/fonts/glyphicons-halflings-regular.ttf>; rel=".$method_font."; as=font; crossorigin type=\"font/ttf\"";
		$font_pushes[] = "</co/fontawesome/webfonts/fa-brands-400.woff2>; rel=".$method_font."; as=font; crossorigin type=\"font/woff2\"";
		$font_pushes[] = "</co/fontawesome/webfonts/fa-brands-400.woff>; rel=".$method_font."; as=font; crossorigin type=\"font/woff\"";
		$font_pushes[] = "</co/fontawesome/webfonts/fa-brands-400.ttf>; rel=".$method_font."; as=font; crossorigin type=\"font/ttf\"";
		$font_pushes[] = "</co/fontawesome/webfonts/fa-solid-900.woff2>; rel=".$method_font."; as=font; crossorigin type=\"font/woff2\"";
		$font_pushes[] = "</co/fontawesome/webfonts/fa-solid-900.woff>; rel=".$method_font."; as=font; crossorigin type=\"font/woff\"";
		$font_pushes[] = "</co/fontawesome/webfonts/fa-solid-900.ttf>; rel=".$method_font."; as=font; crossorigin type=\"font/ttf\"";
		$font_pushes[] = "</co/fontawesome/webfonts/fa-regular-400.woff2>; rel=".$method_font."; as=font; crossorigin type=\"font/woff2\"";
		$font_pushes[] = "</co/fontawesome/webfonts/fa-regular-400.woff>; rel=".$method_font."; as=font; crossorigin type=\"font/woff\"";
		$font_pushes[] = "</co/fontawesome/webfonts/fa-regular-400.ttf>; rel=".$method_font."; as=font; crossorigin type=\"font/ttf\"";
		$font_pushes = array_unique($font_pushes);
		$font_pushes = implode(',',$font_pushes);
		header('Link: '.$font_pushes, false);
		$pushed_cookie_array['ft'] = 1;
	}
But you will have to edit those urls yourself to your own font file locations, the above are mine.
Only put font files in there which are needed but not referenced in your html as those are already covered.

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 letxobnav » Mon Jun 08, 2020 10:10 pm

but more important question about push images.
any ideas what check or set to use correctly push images?
well, show a screenshot of when you push images and the errors it gives and where, everytime I check you are not pushing anything.

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 12:25 am

letxobnav wrote:
Mon Jun 08, 2020 10:10 pm
but more important question about push images.
any ideas what check or set to use correctly push images?
well, show a screenshot of when you push images and the errors it gives and where, everytime I check you are not pushing anything.
I try near 01:00 CET

I cannot leave site on unworking state for long time :(
Image

Image

tonight near 01:00 CET again trying.

New member

Posts

Joined
Sat Feb 04, 2017 2:53 am

Post by AndreyPopov » Tue Jun 09, 2020 7:20 am

Code: Select all

$pushImage 	= true;
Image

New member

Posts

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

Users browsing this forum: No registered users and 52 guests