5

So I have simple express app. When it run locally, I can see js, css files got gzip compressed but when I deploy to cloud foundry, those files not compressed. The files size still the same. Anyone know the reason, how to fix it or solutions for this issue ?

const express = require('express');
const compression = require('compression');
const app = express();

app.use(compression());
app.use(express.static('./public'));

Package.json

{
  "name": "conversation-simple",
  "description": "A simple Node.js based web app which shows how to use the Conversation API to recognize user intents.",
  "version": "0.1.1",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "@google/chatbase": "^1.1.2",
    "body-parser": "^1.18.2",
    "botbuilder": "^3.15.0",
    "cloudant": "^1.10.0-NOTICE",
    "compression": "^1.7.3",
    "cors": "^2.8.4",
    "dotenv": "^2.0.0",
    "express": "^4.16.1",
    "gulp-rename": "^1.4.0",
    "moment": "^2.22.2",
    "nano": "^6.4.4",
    "request": "^2.87.0",
    "slick-carousel": "^1.8.1",
    "underscore": "^1.9.0",
    "universal-analytics": "^0.4.16",
    "watson-developer-cloud": "^3.5.3",
    "xml-js": "^1.6.3"
  },
  "engines": {
    "node": "8.15.x"
  }
}

Update:

Look like there is location problem. When it's deployed to Sydney, the compression doesn't work but Dallas is ok. IBM support have confirmed the issue in my ticket and currently investigate.

DarknessZX
  • 686
  • 3
  • 12

2 Answers2

1

I have the same issue, I feel like I've tried absolutely everything so far: Static Gzipping (serving .gz files) Brotli (no dice) Dynamic compression (like you) Redirect to static .gz files

It works locally as it should but once deployed - farting noise nothing.

I have a feeling it happens in the proxy and needs to be enabled somewhere, where is not documented though

Commenting here to follow this, also I've contacted their support, if I get any answers I will put them here :)

  • I have contacted their support but no result. But yesterday I got recognize something strange. I have other account and the compression work fine. So I try to push the same code base to both account. Got other account working and another not work (although I have create another cloud foundry app). The different between those 2 are: The not working is paid account, deploy location. Will try again with another account. – DarknessZX May 10 '19 at 01:52
  • I'm in contact with support, they said they would run it by the buildpack team ^^ awesome discovery, I have thrown the towel in the ring until aupport gets back – Mikkel Graph Petersen May 12 '19 at 15:14
0

This issue was fixed by IBM.

"After investigation, we found an issue that strips the header and decompresses the response in the Cloud Foundry Platform AU-SYD region."

DarknessZX
  • 686
  • 3
  • 12