-
Notifications
You must be signed in to change notification settings - Fork 228
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
Refactor the part of SaaS visits optimizations #7299
Comments
Do we need to include the feature value as part of the body when we send the url to SaaS ? |
@Khadreal let's think about it, I think it'd be better to send the value of the feature because we will get it with the response and we may use it (or may not). If it's hard or will take much time, we can send a default value for this first phase and change this if needed. what do u think? |
We can create a function to get the header when SaaS visit, somehting like this
In this file we would include the feature available(probably use filter to get the features that's enabled) and send as array (eg In this section
instead of checking for get request here, we would pass the feature name to the function created above to check if it's part of the header if( ! $this->get_saas_request_header('lrc') && ! $this->get_saas_request_header('lcp') {...} Change the get request here
Update test Estimation |
LGTM |
I just have one concern about a case here: |
Is your feature request related to a problem? Please describe.
That's a dev initiative, currently we detect the SaaS visit using a query string called
wpr_imagedimensions
orwpr_lazyrendercontent
but we needed a proper way to detect the SaaS visits for warmup or doing SaaS optimizations.This is the plugin part of this issue:
https://github.com/wp-media/nodejs-treeshaker/issues/810
Describe the solution you'd like
Currently in SaaS we implemented a way to identify that the current visit is from SaaS not a real visit by adding a header called
Wpr-Opt-List
which has the valuesrucss
(we need to set a standard here with @mostafa-hisham so we all be aligned on the names here)@mostafa-hisham told me that the values of this header is coming from a config we should send with the request named
optimization_list
so we need to make sure that we correctly send this config.So we will create a new buffer based on this header in the request exactly like we did here:
wp-rocket/inc/Engine/Common/PerformanceHints/Frontend/Subscriber.php
Lines 69 to 97 in 4b9193b
Then with each feature that we need to apply optimizations specifically with SaaS visits, we will need to use this filter after checking the value of the header, so let's take an example:
Header
Wpr-Opt-List
has the valuerucss, lrc
So if we want to target rucss visits from SaaS we will check if the header contains the value of
rucss
then add anything to the buffer HTML and so on.We need here to mention all the features that needs to be refactored, I'll mention what I'm sure about but feel free to update it with grooming:
The text was updated successfully, but these errors were encountered: