question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

removeHeader("Pragma") not working

See original GitHub issue

What kind of issue is this? Bug Report

hi, i’ve been trying to cache a response from a test rest api from http://jsonplaceholder.typicode.com

D/OkHttp: --> GET http://jsonplaceholder.typicode.com/posts/ http/1.1 D/OkHttp: --> END GET D/OkHttp: <-- 200 OK http://jsonplaceholder.typicode.com/posts/ (2597ms) D/OkHttp: Content-Type: application/json; charset=utf-8 D/OkHttp: Transfer-Encoding: chunked D/OkHttp: Connection: keep-alive D/OkHttp: Pragma: no-cache D/OkHttp: Date: Mon, 15 Aug 2016 07:37:59 GMT D/OkHttp: Set-Cookie: __cfduid=d7a80d31f44b803e5756cb4712926db891471246679; expires=Tue, 15-Aug-17 07:37:59 GMT; path=/; domain=.typicode.com; HttpOnly D/OkHttp: X-Powered-By: Express D/OkHttp: Vary: Accept-Encoding D/OkHttp: Access-Control-Allow-Credentials: true D/OkHttp: Expires: Mon, 15 Aug 2016 11:37:59 GMT D/OkHttp: X-Content-Type-Options: nosniff D/OkHttp: Etag: W/“6b80-uPwhAkDat3Fl5TugzmyYpQ” D/OkHttp: Via: 1.1 vegur D/OkHttp: CF-Cache-Status: HIT D/OkHttp: Server: cloudflare-nginx D/OkHttp: CF-RAY: 2d2afc05360e22be-LAX D/OkHttp: Cache-Control: max-age=20 D/OkHttp: <-- END HTTP

i was successfully caching that response, along with also modifying the cache-control, however, all my efforts to remove Pragma: no-cache with response.removeHeader("Pragma") on my interceptor seems to have failed and i’m not sure why. That pragma prevents me from accessing my saved cache for offline work.

can someone give light to this?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jpasenetacommented, Aug 19, 2016

@swankjesse just followed your advice instead. since http://www.jsonplaceholder.typicode.com is a free test rest api, it’s hard to play around with its server responses. I switched to www.mocky.io instead where i can modify server response codes/headers.

There might be something that’s preventing me from removing the “Pragma” header as i’m trying these out.

You can close the issue. Thank you.

0reactions
swankjessecommented, Aug 19, 2016

Could you provide a complete executable test case? As is it’s unclear where the problem is.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't remove Pragma header DevCentral
Having some content caching issues with a client and I'd like to remove the Pragma header in the event that it's messing things...
Read more >
Can't remove Pragma header - DevCentral
Having some content caching issues with a client and I'd like to remove the Pragma header in the event that it's messing things...
Read more >
Retrofit OKHTTP Offline caching not working - Stack Overflow
removeHeader ("Pragma") as shown below (This lets you override the server's caching protocol); Avoid using the HttpLoggingInterceptor while ...
Read more >
nginx remove header from upstream - Server Fault
if i try set "Pragma" to something else, it works, but "" not seems to work. nginx · http-headers · Share.
Read more >
Retrofit 2: Http Caching in Android | by SHISHIR - Medium
Make sure you are using a GET request and not a POST! Always make sure you add .removeHeader("Pragma"). Avoid using the HttpLoggingInterceptor while...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found