Skip to content

Generic CDN support #457

@diimpp

Description

@diimpp

Hello,

I'm tasked with implementing CloudFlare cache invalidation and I've noticed, that HttpProxyClient design is not really compatible with generic CDN cache invalidation flow.

What usually happens with CDN is rest post request with json body. Single or multiple urls, headers, etc.

And for example it's not possible to supply body to the request factory of the HttpProxyCache
https://github.com/FriendsOfSymfony/FOSHttpCache/blob/master/src/ProxyClient/HttpProxyClient.php#L94

I do realise, that I can just implement ProxyClient interface and do the rest of the implementation as I need to.
And that HttpProxyClient is not generic solution, but a specialized version for direct communication with proxy servers line nginx or varnish, but it's kind of feels wrong to have HttpProxyClient name wise, while it doesn't allow to send body.

Not sure what this issue is about. :) RFC for renaming HttpProxyClient? Add some mention on CDN's or custom ProxyClient implementation?

CF purge request looks like so

curl -X POST "https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/purge_cache" \
     -H "X-Auth-Email: [email protected]" \
     -H "X-Auth-Key: abcdefg" \
     -H "Content-Type: application/json" \
     --data '{"files":["http://www.example.com/css/styles.css",{"url":"http://www.example.com/cat_picture.jpg","headers":{"Origin":"cloudflare.com","CF-IPCountry":"US","CF-Device-Type":"desktop"}}]}'

Related #142
#403

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions