Skip to content

Responses should have Cache-Control header to avoid being cached by public Caches / CDNs #4842

@Frank683

Description

@Frank683

Describe the bug

Our web application is running on Microsoft Azure App Service and is published through Azure Frontdoor which is a CDN which
caches all responses to GET requestes which are deemed as "cacheable".

https://learn.microsoft.com/en-us/azure/frontdoor/front-door-caching?pivots=front-door-standard-premium#cache-expiration

image

The server response to the a client's first request which returns the sid to be used for all subsequent requests does not have Cache-Control headers and so the reponse gets cached by Frontdoor CDN which will result in other users receiving this cached response instead of a "fresh" one.

image

The subsequent request uses the session ID from the cached response which probably belonged to another user and might not be valid anymore:

image

To Reproduce

Socket.IO server version: 4.4.1

Server

  let server = http.createServer(app);
  let socketio = SocketIO(server);

  // General server listening
  server.listen(config.server.port, function () {
      logger.info('Express server listening on port ' + server.address().port);
  });

  socketio.on('connection', function (socket) {
        logger.debug('Client with SocketId [%s] connected ...', socket.id);
  });

Socket.IO client version: 4.4.1

Client

initSocket: function (oController) {
        if (!this.oSocket) {
          this.oSocket = io();

          this.oSocket.on('myevent', function (oData) {
            var oReceived = JSON.parse(oData);

            // Do something with the data....
        }
      },

Expected behavior
Every response should have http header

Cache-Control: no-store, no-cache

Platform:

  • Device: PC
  • OS: Windows 10

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions