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

As a hosting service, I want RUCSS requests to directly target the correct URL with trailing slashes to avoid additional traffic because of redirections #6438

Closed
MathieuLamiot opened this issue Feb 8, 2024 · 0 comments · Fixed by #6455
Assignees
Labels
module: remove unused css priority: high Issues which should be resolved as quickly as possible type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Milestone

Comments

@MathieuLamiot
Copy link
Contributor

MathieuLamiot commented Feb 8, 2024

Context
See here: we got traffic logs from a hosting service and a significant part of the traffic generated by RUCSS is due to redirections because the initial requested URL is missing a trailing slash.

[08/Feb/2024:17:18:05 +1100] "GET /practitioners/michael-thiel-paul?nowprocket=1&no_optimize=1 HTTP/2" 301 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"
[08/Feb/2024:17:18:06 +1100] "GET /practitioners/michael-thiel-paul/?nowprocket=1&no_optimize=1 HTTP/2" 200 41437 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"

The URL is re-written: /practitioners/michael-thiel-paul -> /practitioners/michael-thiel-paul/

Trailing slashes are usually added or not through permalink rules.

Expected behavior
URLs that the plugin sends to the SaaS should correctly contain or not trailing slashes, according to the permalink structure defined in WP.

How to reproduce

Enregistrement.de.l.ecran.2024-02-08.a.13.18.08.mov
  • Get or setup a website with WP Rocket and WP permalinks configured with a trailing slash. For example, gamma rocketlabsqa website is currently defined this way.
  • Make sure RUCSS is enabled on the website.
  • Check the table wp_wpr_rucss_used_css in the DB for jobs that were completed less than 7 days ago. If there are not any, clear used CSS and browse a bit to trigger some RUCSS jobs.
  • Retrieve the ULID part of a recently completed job (the string after the '--' in the Job Id column) where the job Id begins with LIVE2-CPH3-PROD: It means the job was processed by a group.One server and the job data is available in Metabase.
  • Go to Metabase and create a new native query on SaaS director DB. Use this query:
with result as (select * from saas_job 

    where "jobIdInQueue" = '01HNZ8V0T6CMTQ25ENY1K95D60' limit 1)
    
    select * from result join saas_optimizationrequest on result."optimizationRequest_id" = saas_optimizationrequest.uuid

Just replace the ULID by the one of your job.

Check in the result, there should be a column named URL. IT does not have the trailing slash. Open this URL in a browser and you will see the 301 HTTP Code.

Acceptance Criteria

  • Perform the "How to reproduce" with clearing cache & used CSS and browsing a bit to regenerate jobs. The URL at the end must have the trailing slash.
  • Re-do the same but with permalinks configured without a trailing slash. The URL at the end must have no trailing slash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: remove unused css priority: high Issues which should be resolved as quickly as possible type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants