Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

soft_purge doesn't actually issue soft header - it's a hard purge #62

Open
mrthan opened this issue Jul 30, 2016 · 1 comment
Open

soft_purge doesn't actually issue soft header - it's a hard purge #62

mrthan opened this issue Jul 30, 2016 · 1 comment

Comments

@mrthan
Copy link

mrthan commented Jul 30, 2016

Same code as #61. Running fastly-rails#0.7.1 using httplog to watch requests.

I don't see any Fastly-Soft-Purge:1 header being sent with the request as the docs indicate. It looks like fastly-rails/client.rb is keeping it too simple and not deferring the the fastly api gem to do this correctly.

after_save :soft_purge results in

DEBUG -- : [httplog] Sending: POST http://api.fastly.com:443/service/ABC123/purge/mykey/123
DEBUG -- : [httplog] Data: 
DEBUG -- : [httplog] Status: 200
DEBUG -- : [httplog] Benchmark: 0.12983361499937018 seconds
DEBUG -- : [httplog] Response: {"status": "ok", "id": "577-xxxx-32"}

From the docs I'm expecting to see a PURGE request and a header sent

@thommahoney
Copy link
Member

@mrthan I don't see any request headers being logged in your paste above.

fastly-rails#0.7.1 uses fastly-ruby#1.6.0 which supports soft purging by accepting an optional argument in the purge_by_key method. This method is defined here: https://github.com/fastly/fastly-ruby/blob/de9ec93d1cb8444b0fa3e6ae344de96cd429ff24/lib/fastly/service.rb#L72

When the soft argument is true, we append the Fastly-Soft-Purge header to the API request.

We call Fastly::Service#purge_by_key here:

Fastly::Service.new({id: FastlyRails.service_id}, FastlyRails.client).purge_by_key(*args)
which is called by the soft_purge method here:
FastlyRails.purge_by_key(record_key, true)
(note the true argument)

Could I have you confirm that the Fastly-Soft-Purge header is indeed not being sent?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants