Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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;


when i request to "" link, image returns me, but nginx doesnt know what is JSESSIONID.

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

share|improve this question
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 ;… (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 4:36
It shouldn't care what path it's proxying - how is your nginx configured? – Shane Madden Jul 23 '12 at 6:05 – Rahman Usta Jul 23 '12 at 6:56
in html directory static files stands. but, facebook.png;jsessionid=07ab5b915530738297010cbc0b5c.worker1" is not a file name – Rahman Usta Jul 23 '12 at 6:57
up vote 1 down vote accepted
location ~* ^(.+\.(?:jpe?g|gif|css|png|js|ico))(?:;.+)?$ {
    try_files $1 =404;
    access_log off;
    expires max;
share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.