Why My Cloud Pak Web UI is So Slow

Caching and Non-trusted Certificate

Zhimin Wen

--

Image by Franck Barske from Pixabay

I have API Connect installed on OpenShift with Cloud Pak for Integration. Each time when open a UI, it is taking minutes to get the page fully rendered. Why?

Take the example of Cloud Manager Web Console, total about 70+ MB files (javacript and other static files) need to be downloaded. For each refresh, all these files are downloaded again. There seems no caching of these static files at all.

It turns out Chromium based browser will not cache any static content when the HTTPS traffic is not secured, this includes self-signed certificate or mis-configured certificate. Check out this link,

https://bugs.chromium.org/p/chromium/issues/detail?id=110649#c8

Let’s have a quick experiment with it

A Quick HTTPS File Server for Testing

Create our own CA cert and certificate with the cfssl tool in the directory of certs

Run a testing HTTPS server with Golang magefile

func (Https) T01_serve() {
fileServerHandler := http.FileServer(http.Dir("static"))
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
reqDump, _ := httputil.DumpRequest(r, false)
log.Printf("%s", reqDump)
fileServerHandler.ServeHTTP(w, r)
})

try.E(http.ListenAndServeTLS(":8443", "cert/mycert.pem", "cert/mycert-key.pem", handler))
}

Create a test file under static/test.txt

Notice we have the CA certs self signed, therefore the certificate is not trusted. Launch Chrome, go to the following URL,

https://localhost:8443/test.txt

Proceed with the untrusted certificate. Each time when the test.txt is requested, it fire with Cache-control: max-age=0 No local caching of the static file.

GET /test.txt HTTP/2.0
Host: localhost:8443
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
Cache-Control: max-age=0
Sec-Ch-Ua: "Google Chrome";v="119", "Chromium";v="119", "Not?A_Brand";v="24"
Sec-Ch-Ua-Mobile: ?0…

--

--