-
Notifications
You must be signed in to change notification settings - Fork 233
FIX #7942: Varnish Purge on Cloudways #7948
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
base: develop
Are you sure you want to change the base?
Conversation
- Route PURGE requests through Nginx (port 80) instead of directly to Varnish (port 8080) - Ensures Nginx adds required X-Real-IP header for Cloudways' new VCL - Update test fixtures to reflect port change Fixes #7942
|
Special mention to @jeawhanlee , regarding this comment,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a critical Varnish purge issue on Cloudways hosting by updating the integration to work with Cloudways' new VCL configuration. The fix changes the Varnish port from 8080 to 80 and adds the required X-Real-IP header to ensure PURGE requests are properly routed through Nginx.
- Changed Cloudways Varnish IP from
127.0.0.1:8080to127.0.0.1:80to route requests through Nginx - Added
add_purge_headers()method to inject X-Real-IP header required by Cloudways' VCL - Comprehensive test coverage for the new header injection logic with edge cases
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| inc/ThirdParty/Hostings/Cloudways.php | Updated Varnish port from 8080 to 80 and added new add_purge_headers() method to inject X-Real-IP header when Varnish is running |
| tests/Unit/inc/ThirdParty/Hostings/Cloudways/addPurgeHeaders.php | New unit test for add_purge_headers() method using direct method invocation |
| tests/Integration/inc/ThirdParty/Hostings/Cloudways/addPurgeHeaders.php | New integration test for add_purge_headers() using filter hook to verify WordPress integration |
| tests/Fixtures/inc/ThirdParty/Hostings/Cloudways/addPurgeHeaders.php | New test fixture with 6 scenarios covering Varnish states and header combinations |
| tests/Fixtures/inc/ThirdParty/Hostings/Cloudways/varnishIP.php | Updated expected Varnish IP port from 8080 to 80 across all test scenarios |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
|
@Miraeld From my little findings, if you log |
Description
Fixes #7942
Change Cloudways Varnish port from 8080 to 80
Type of change
Detailed scenario
What was tested
How to test
Prerequisites:
Steps:
Expected result:
Technical description
Documentation
This pull request enhances the integration with Cloudways Varnish caching by ensuring that the correct headers and IP addresses are used during purge requests. It introduces a new method to add the
X-Real-IPheader when Varnish is detected, updates the default Varnish IP, and adds comprehensive tests to verify this behavior.Cloudways Varnish integration improvements:
add_purge_headers, inCloudways.phpto inject theX-Real-IP: 127.0.0.1header into Varnish purge requests when Varnish is running, and registered it to therocket_varnish_purge_headersfilter. [1] [2]127.0.0.1:8080to127.0.0.1:80inCloudways.phpand updated related test fixtures to reflect this change. [1] [2] [3] [4] [5]Testing improvements:
addPurgeHeaders.php, with various scenarios for header injection based on Varnish status.add_purge_headersunder different server configurations. [1] [2]Mandatory Checklist
Code validation
Code style