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

Cloudways - Varnish cache is not cleared when the Varnish add-on is enabled #1257

Closed
vmanthos opened this issue Oct 18, 2018 · 13 comments · Fixed by #2628
Closed

Cloudways - Varnish cache is not cleared when the Varnish add-on is enabled #1257

vmanthos opened this issue Oct 18, 2018 · 13 comments · Fixed by #2628
Assignees
Labels
3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting effort: [S] 1-2 days of estimated development time module: Varnish add-on needs: documentation Issues which need to create or update a documentation priority: high Issues which should be resolved as quickly as possible
Milestone

Comments

@vmanthos
Copy link
Contributor

vmanthos commented Oct 18, 2018

Describe the bug
On Cloudways, Varnish cache is not purged when WP Rocket's cache is cleared (Varnish add-on is enabled).

This leads to 404 on minified files.

Steps to reproduce the issue

  1. Use a Cloudways-hosted website where Varnish is enabled. We don't have one currently, so we should create it from scratch.
  2. Enable the Varnish add-on.
  3. Make a change to a post.
  4. Clear WP Rocket's cache.
  5. Check, in an incognito browser window, for the updated post.

Related Ticket
https://secure.helpscout.net/conversation/686147105/83005/?folderId=2135277

@arunbasillal
Copy link
Contributor

Possibly related ticket: https://secure.helpscout.net/conversation/718924487/88376/

@webtrainingwheels
Copy link

This needs further testing to validate.

I just had a similar case and it was solved by using this helper:
https://docs.wp-rocket.me/article/891-purge-varnish-when-using-a-proxy

on this site: https://bitcoin-casino-no-deposit-bonus.com
Cloudways + Varnish + Cloudflare.
Varnish Age header was reset to 0 after WP Rocket cache purge.

@arunbasillal
Copy link
Contributor

@webtrainingwheels What is the IP you used in the proxy? I tried with 127.0.0.1 and ports 8080 and 6082. No luck.

@webtrainingwheels
Copy link

@Tabrisrp Tabrisrp added 3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting module: Varnish add-on labels Jan 29, 2019
@piotrbak
Copy link
Contributor

piotrbak commented Nov 7, 2019

Cloudways provides an API to clear Varnish. That's probably the most reliable way to handle it:
https://www.cloudways.com/blog/automatically-purging-varnish-cache-using-cloudways-api/

@piotrbak
Copy link
Contributor

@webtrainingwheels What is the IP you used in the proxy? I tried with 127.0.0.1 and ports 8080 and 6082. No luck.

Setting custom Varnish IP to 127.0.0.1:8080 resolved the problem for me.

@Contributolo
Copy link

I had no success to use WP Rocket with CLoudways and varnish. I tried the helper plugin and filled in:
127.0.0.1:8080 fpr varnish ip. But the varnish cache isn't cleared when I clear the wp rocket cache... so I cannot use WP Rocket along with cloudways and varnish?

@alfonso100
Copy link
Contributor

Another case here:
https://secure.helpscout.net/conversation/1037049553/137432?folderId=2683093

In this case, using the following helper solved the issue:
https://github.com/wp-media/wp-rocket-helpers/blob/master/compatibility/wp-rocket-compat-varnish-ip-proxy/wp-rocket-compat-varnish-ip-proxy.php

I had to set​ a custom varnish host: subdomain.domain.com,
​And also a custom varnish IP and port: 127.0.0.1:8080

I've noticed a difference between WP Rocket Varnish function and Breeze's Varnish function, specifically in the parameters we use at the wp_remote_request(). So I left a note with some additional comments on the ticket. Just in case it helps.

@GeekPress GeekPress added needs: details priority: high Issues which should be resolved as quickly as possible labels Mar 23, 2020
@GeekPress GeekPress added this to the 3.5.4 milestone Mar 31, 2020
@Tabrisrp
Copy link
Contributor

Tabrisrp commented Apr 6, 2020

Could we get a direct line with Cloudways about this?

Looking at the history, different solutions seem to have worked at different times, so it's hard for the dev team to determine the one solution to go with.

Looking at the Breeze plugin, when they perform the Varnish cache purge, the default value for the host is 127.0.0.1. So some clarifications would be really helpful for us.

@GeekPress
Copy link
Contributor

@GeekPress GeekPress modified the milestones: 3.5.4, 3.5.5 Apr 13, 2020
@GeekPress
Copy link
Contributor

@Tabrisrp Cloudways replied to the tweet with an email to contact. Could you please contact them?

@Tabrisrp
Copy link
Contributor

Message sent

@Tabrisrp Tabrisrp added status: blocked Issue or PR is blocked by external factor. needs: grooming and removed needs: details status: blocked Issue or PR is blocked by external factor. labels May 4, 2020
@Tabrisrp
Copy link
Contributor

Tabrisrp commented May 7, 2020

Received everything we need to work on this

Scope a solution

  • Create a compatibility class: WP_Rocket\ThirdParty\Hostings\Cloudways
  • We can use the $_SERVER['cw_allowed_ip'] variable to identify that we are on Cloudways
  • Auto-enable Varnish + display custom message on Varnish add-on, like we do for Flywheel for example
  • Cloudways Varnish uses http://127.0.0.1:8080 for its URL, filter rocket_varnish_ip

Effort
Effort [S]

@Tabrisrp Tabrisrp added effort: [S] 1-2 days of estimated development time and removed needs: grooming labels May 7, 2020
@Tabrisrp Tabrisrp self-assigned this May 10, 2020
@Tabrisrp Tabrisrp linked a pull request May 10, 2020 that will close this issue
3 tasks
@webtrainingwheels webtrainingwheels added the needs: documentation Issues which need to create or update a documentation label May 11, 2020
Tabrisrp added a commit that referenced this issue May 11, 2020
* add cloudways compatibility file
* add cloudways tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting effort: [S] 1-2 days of estimated development time module: Varnish add-on needs: documentation Issues which need to create or update a documentation priority: high Issues which should be resolved as quickly as possible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants