cnken / substitutions4nginx

Automatically exported from code.google.com/p/substitutions4nginx
3 stars 3 forks source link

subs_filter_types not work with javascript #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Nginx version 1.2.4
subtitutions4nginx  rev 62, the latest version from Github version has the same 
problem.

Here is test step:

Defaut action: no directive
Substitution works only for text/html as described.

Case 1: subs_filter_types text/html text/javascript;

Nginx produce a warning: 
nginx: [warn] duplicate MIME type "text/html" in 
/home/nginx/data/conf/6pm2.conf:1
Substitution works only for text/html

Case 2: subs_filter_types text/javascript;
Substitution works only for text/html

Case 3: subs_filter_types application/javascript;
Substitution works only for text/html

---

Encoding is turned off: proxy_set_header Accept-Encoding "";

I was tryin with gzip both ON and OFF with the same result. I think Issue 17 
about the same problem.

Original issue reported on code.google.com by r.shishkin@gmail.com on 28 Oct 2012 at 11:42

GoogleCodeExporter commented 9 years ago
What's the MIME type of your javescript assets?

Original comment by nbubi...@gmail.com on 29 Oct 2012 at 2:26

GoogleCodeExporter commented 9 years ago
The MIME type is text/javascript according to Chrome development pannel.

Original comment by r.shishkin@gmail.com on 29 Oct 2012 at 7:27

GoogleCodeExporter commented 9 years ago
Is it a HTTP 200 response? Can you show me a example js URL for your problem?

Original comment by nbubi...@gmail.com on 29 Oct 2012 at 8:24

GoogleCodeExporter commented 9 years ago
Yes this is a valid HTTP 200 response.

Here is a path: http://www.6pm.com/karakoram/js/main.6b844c7.js

6pm has a restricted access for some geo location.

Original comment by r.shishkin@gmail.com on 29 Oct 2012 at 2:11

GoogleCodeExporter commented 9 years ago
Hi,

I have turned the gzip off. It seems work for me:

 50         location / {
 51             subs_filter_types text/javascript;
 52             subs_filter "name" yaoweibin;
 53
 54             proxy_set_header Accept-Encoding "";
 55             proxy_pass http://www.6pm.com/karakoram/js/main.6b844c7.js;
 56         }

Is the javascript page compressed by force?

You can use the tools like wget to debug:

wget -d http://127.0.0.1/a.js

wget -d --header="Accept-Encoding: gzip" http://127.0.0.1/a.js

Original comment by nbubi...@gmail.com on 30 Oct 2012 at 7:48

GoogleCodeExporter commented 9 years ago
Yes, you are right!

The problem was due to browser cache. Probaly browser do more
agressive caching for javascript files, so ordinary reloading of page
may be not enough for full refresh.

Thank you for you kindly replies and good work with module.

Original comment by r.shishkin@gmail.com on 5 Nov 2012 at 8:02