1

Im using Nginx as FrontEnd Server, and behind it a Apache Http Server and begind it a Glassfish Application Server :) My problem is, when i need a static context like;

"http://127.0.0.1:8077/directory-web/resources/defaultTheme/images/facebook.png;jsessionid=07ab5b915530738297010cbc0b5c.worker1"

when i request to "http://127.0.0.1:8077/directory-web/resources/defaultTheme/images/facebook.png" link, image returns me, but nginx doesnt know what is JSESSIONID.

In production, Glassfish will be in two cluster. Thanks.

Rahman Usta
  • 143
  • 1
  • 1
  • 7
  • 1
    What do you mean by "nginx doesnt know what is JSESSIONID"? What problem are you having - what does nginx need to do with the JSESSIONID? – Shane Madden Jul 22 '12 at 21:52
  • Path to facebook.png is ; http://127.0.0.1:8077/directory-web/resources/defaultTheme/images/facebook.png (this ok), but do you know a path like this ....eme/images/facebook.png;JKDFBJDBVD ?? 404 STATUS CODE TURNS me by Nginx, coz its not a path only a cookie – Rahman Usta Jul 23 '12 at 04:36
  • It shouldn't care what path it's proxying - how is your nginx configured? – Shane Madden Jul 23 '12 at 06:05
  • http://chopapp.com/#5pwm5dcf – Rahman Usta Jul 23 '12 at 06:56
  • in html directory static files stands. but, facebook.png;jsessionid=07ab5b915530738297010cbc0b5c.worker1" is not a file name – Rahman Usta Jul 23 '12 at 06:57

1 Answers1

1
location ~* ^(.+\.(?:jpe?g|gif|css|png|js|ico))(?:;.+)?$ {
    try_files $1 =404;
    access_log off;
    expires max;
}
VBart
  • 8,309
  • 3
  • 25
  • 26
  • you except all static resource, but i need only except ;jsessionidblablabla – Rahman Usta Jul 23 '12 at 19:47
  • `location ~* ^(.+\.(?:jpe?g|gif|css|png|js|ico));jsessionid= {` – VBart Jul 23 '12 at 20:17
  • but, it must accept jpeg,gif,css,png,js and ico for example : xx.png and xx.js?fgdfgjd but it shouldnt accept xx.png;jsessionbdljgdno – Rahman Usta Jul 24 '12 at 13:00
  • I'm totally confused. And what do you mean by `it must accept`? – VBart Jul 24 '12 at 13:08
  • **1.** `^(.+\.(?:jpe?g|gif|css|png|js|ico))(?:;.+)?$` - matches jpeg,gif,css,png,js and ico with or without `;something` at the end. **2.** `^(.+\.(?:jpe?g|gif|css|png|js|ico));jsessionid=` matches jpeg,gif,css,png,js and ico only with ;jsessionid= at the end. **3.** `\.(?:jpe?g|gif|css|png|js|ico)$` - matches jpeg,gif,css,png,js and ico only without anything at the end. – VBart Jul 24 '12 at 13:11
  • i need jpeg,gif,css,png,js and ico only WITHOUT ;jsessionid= at the end – Rahman Usta Jul 24 '12 at 13:21
  • But what else can be after `.png`, `.jpeg`, `.css`...? – VBart Jul 24 '12 at 14:17
  • after them everything can be but except ;jsessionBlaBlaBla – Rahman Usta Jul 24 '12 at 15:39
  • Could you give an example. This is just strange, and `;blabla` is something non-standard to the web. – VBart Jul 24 '12 at 15:52
  • Anyway, this is exactly what do you want .................................................................................. `location ~* ^(.+\.(?:jpe?g|gif|css|png|js|ico))(?:$|;(?!jsessionid=)) {` – VBart Jul 24 '12 at 15:59
  • bla bla refers to zero, one, or more thing – Rahman Usta Jul 24 '12 at 19:07
  • I understand what blabla is. =), but `;` is a non-standard method of passing things. – VBart Jul 24 '12 at 19:55
  • JSF uses this technic, can i rewrite url getting rid of ;jsessionBlablabla :) – Rahman Usta Jul 25 '12 at 06:37
  • You can, I already posted here four regular expressions for all possible cases. What's problem? You can write your own, `man pcrepattern`. – VBart Jul 25 '12 at 12:26