Hello All,

Our application operates on a dual-server setup, where each server is
dedicated to running a distinct API.

*Technical specifications:*
Framework: Spring-boot v2.4 (Java 1.8)
Runtime Environment: Tomcat
Version: Apache Tomcat/7.0.42
Server1 runs API-1 and Server2 runs API-2. Both servers are equipped with
an installed Varnish application. When either API is accessed, the request
is processed through the Varnish instance associated with the respective

*Issue Description:*
In a typical scenario, a client (browser) sends a request to API-1, which
is handled by the Varnish instance on Server1. After initial processing,
API-1 makes a subsequent request to API-2 on Server2.

The Request Flow is as follows:
*Browser --> Varnish on Server1 --> Tomcat on Server1 --> Varnish on
Server2 --> Tomcat on Server2*

*Assuming, the request from Browser will be a miss at Server1 Varnish so
that the request reaches Tomcat(Backend) on server1.*

In cases where the browser *does not include any cache-control headers in
the request* (e.g., no-cache, max-age=0), the Server1 Varnish instance
correctly *does not receive any cache-control headers*.

*However, when API-1 calls API-2, we observe that a cache-control: no-cache
and p**ragma: no-cache headers are being transmitted to the Varnish
instance on Server2*, despite the following conditions:

1. We are not explicitly sending any cache-control header in our
application code during the call from API-1 to API-2.
2. Our application does not use the Spring-security dependency, which by
default might add such a header.
3. The cache-control header is not being set by the Varnish instance on

This unexpected behavior of receiving a cache-control header at Server2's
Varnish instance when invoking API-2 from API-1 is the crux of our issue.

We kindly request your assistance in understanding the cause of this
unexpected behavior. Additionally, we would greatly appreciate any guidance
on how to effectively prevent this issue from occurring in the future.

Thanks & Regards
Uday Kumar

Reply via email to