# Topic Preview Broken (due to Google PageSpeed Module)

**URL:** https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142
**Category:** Support
**Created:** [August 31, 2017, 2:17pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142 "2017-08-31T14:17:03Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Geoffrey\_Challen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/geoffrey_challen/32/119637_2.png) [@Geoffrey\_Challen](https://meta.discourse.org/u/Geoffrey_Challen)
#### Post date: [August 31, 2017, 2:17pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/1 "2017-08-31T14:17:03Z")

</div>

First I’d like to say thanks to all that work on Discourse. I’m a CS professor and I’ve used it for multiple courses. It’s far superior to Piazza, and I like being able to tell students that we’re using community-supported software. Keep up the good work.

I’ve put up the latest version of Discourse at [Learn CS Online: An Introduction to Computer Science](https://cs125.cs.illinois.edu/forum/). I know that this is a subfolder install, and not completely supported, but it’s working fairly well. I’ve followed the instructions, and used my logs to hunt down some places where images weren’t being prefixed properly.

Except that the topic preview pane is not working. In a related problem, I can’t view the content of posts that have been queued for moderation. I can see an error in the Chrome developer console about “Cannot read property ‘getResponseHeader’ of undefined.” (I wanted to post the screenshot but only get one per topic and the Safari one is probably more revealing.)

On Safari the error is a bit more interesting:

 ![image](https://global.discourse-cdn.com/meta/original/3X/2/7/273f7167d0851466eef207a5af5168ed49f5be95.png)  
I don’t see any errors in the server-side logs, but perhaps I’m not looking in the right place.

I’ve installed Let’s Encrypt certificates on [cs125.cs.illinois.edu](http://cs125.cs.illinois.edu) and have an nginx instance handling the encryption and reverse proxying to the Discourse container over a socket. I wonder if I need to add some `Access-Control-Allow-Origin` headers to my nginx configuration to get this to work?

Additional information: we’re on 1.9.0.beta7 and have no non-official plugins installed.

Any help tracking this down would be greatly appreciated, and will be a nice open source support success story to share with my students 😄.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 31, 2017, 3:15pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/2 "2017-08-31T15:15:52Z")

</div>

Have you had a read through?

[https://meta.discourse.org/t/message-bus-doesnt-respect-subfolder/31119/3?u=sam](https://meta.discourse.org/t/message-bus-doesnt-respect-subfolder/31119/3)

---

<div class="post-metadata">

### Author: ![Geoffrey\_Challen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/geoffrey_challen/32/119637_2.png) [@Geoffrey\_Challen](https://meta.discourse.org/u/Geoffrey_Challen)
#### Post date: [August 31, 2017, 3:36pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/3 "2017-08-31T15:36:23Z")

</div>

It’s set to `/forum/`. Should it be an absolute URL? And do I need to rebuild the container afterward? (I’m pretty sure I have rebuilt since changing that setting, since I had to fiddle with the rate limiting settings.)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 31, 2017, 3:39pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/4 "2017-08-31T15:39:04Z")

</div>

I would set it to the absolute, no need to rebuild after changing it AFAIK.

---

<div class="post-metadata">

### Author: ![Geoffrey\_Challen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/geoffrey_challen/32/119637_2.png) [@Geoffrey\_Challen](https://meta.discourse.org/u/Geoffrey_Challen)
#### Post date: [August 31, 2017, 3:47pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/5 "2017-08-31T15:47:42Z")

</div>

No joy. Same problem.

Is there any other information I can provide to help you debug this?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 31, 2017, 3:51pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/6 "2017-08-31T15:51:09Z")

</div>

Have you enabled the force\_ssl site setting?

---

<div class="post-metadata">

### Author: ![Geoffrey\_Challen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/geoffrey_challen/32/119637_2.png) [@Geoffrey\_Challen](https://meta.discourse.org/u/Geoffrey_Challen)
#### Post date: [August 31, 2017, 3:55pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/7 "2017-08-31T15:55:40Z")

</div>

I just turned it on, and now Safari is generating a different problem:

 ![image](https://global.discourse-cdn.com/meta/original/3X/f/2/f20cd2f8d81885077f7bc7a279bacf110c3cbc0c.png)

This seems more similar to the problem that Chrome is reporting.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 31, 2017, 3:57pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/8 "2017-08-31T15:57:02Z")

</div>

Does it work in [Using Safe Mode to troubleshoot issues with themes and plugins](https://meta.discourse.org/t/how-to-use-discourse-safe-mode/53504) ?

---

<div class="post-metadata">

### Author: ![Geoffrey\_Challen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/geoffrey_challen/32/119637_2.png) [@Geoffrey\_Challen](https://meta.discourse.org/u/Geoffrey_Challen)
#### Post date: [August 31, 2017, 4:01pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/9 "2017-08-31T16:01:01Z")

</div>

> [@sam](#):
>
> How to use Discourse [Safe Mode](https://meta.discourse.org/t/53504?silent=true)

Nope. Same problem with all boxes checked.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 31, 2017, 4:15pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/10 "2017-08-31T16:15:38Z")

</div>

This does not look right: [Learn CS Online: An Introduction to Computer Science](https://cs125.cs.illinois.edu/forum/assets/markdown-it-bundle-91aeb6600f2162d2794f12418867fef862f49ea60a788ebe93b131e36535bd08.js)

It should look like this: [https://meta.discourse.org/assets/markdown-it-bundle-91aeb6600f2162d2794f12418867fef862f49ea60a788ebe93b131e36535bd08.js](https://meta.discourse.org/assets/markdown-it-bundle-91aeb6600f2162d2794f12418867fef862f49ea60a788ebe93b131e36535bd08.js)

You have something messed up with the gzip compression setup on the proxy.

---

<div class="post-metadata">

### Author: ![Geoffrey\_Challen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/geoffrey_challen/32/119637_2.png) [@Geoffrey\_Challen](https://meta.discourse.org/u/Geoffrey_Challen)
#### Post date: [August 31, 2017, 4:18pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/11 "2017-08-31T16:18:26Z")

</div>

```plaintext
  gzip on;
  gzip_disable "msie6";
  gzip_vary on;
  gzip_proxied any;
  gzip_comp_level 6;
  gzip_buffers 16 8k;
  gzip_http_version 1.1;
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 31, 2017, 4:23pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/12 "2017-08-31T16:23:17Z")

</div>

Looks like there are some troubleshooting steps here:

> <https://serverfault.com/questions/730883/nginx-reverse-proxy-gzip-to-client>

I would recommend simply testing that single file with curl, fiddle with the config until you can curl that file above and get javascript out of it.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 31, 2017, 4:27pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/13 "2017-08-31T16:27:36Z")

</div>

I get it actually, your NGINX server does not understand brotli.

You got to disable all brotli compression and rebuild. I think you do that by setting

```plaintext
env:
  COMPRESS_BROTLI: 0

```

---

<div class="post-metadata">

### Author: ![Geoffrey\_Challen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/geoffrey_challen/32/119637_2.png) [@Geoffrey\_Challen](https://meta.discourse.org/u/Geoffrey_Challen)
#### Post date: [August 31, 2017, 4:51pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/14 "2017-08-31T16:51:51Z")

</div>

OK—I have a starting point. I’ll work on this and get back to you.

---

<div class="post-metadata">

### Author: ![Geoffrey\_Challen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/geoffrey_challen/32/119637_2.png) [@Geoffrey\_Challen](https://meta.discourse.org/u/Geoffrey_Challen)
#### Post date: [August 31, 2017, 6:12pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/15 "2017-08-31T18:12:21Z")

</div>

Resolved! This turned out to be caused by [Google’s PageSpeed module](https://developers.google.com/speed/pagespeed/). I hadn’t enabled it within my location block, but I guess it’s enabled by default. Disabling it made the compression problem go away.

Thanks so much to @sam for his help! Much appreciated.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [August 31, 2017, 8:19pm UTC](https://meta.discourse.org/t/topic-preview-broken-due-to-google-pagespeed-module/69142/16 "2017-08-31T20:19:51Z")

</div>


