Discussion:
[Symfony2] Can't understand how reverse proxy works
Inori
2011-06-18 06:38:14 UTC
Permalink
What I have:
2 computers on LAN, web server on one of them, to which I have access
from both computers via 192.168.0.100.

Symfony2 which uses reverse proxy cache with e-tag.

app.php: http://pastebin.com/hupi9bYN
controller code: http://pastebin.com/7mWSt3jv

Caching itself works fine (I go to the page from one computer 1st
time: "200 OK" response; I refresh: "304 Not modifed").

What I fail to understand:
After having my content cached via computer one, I try to open the
same page from second computer, but response is again "200 OK". The
way I understood reverse proxy is that it should return "304 Not
modified" for my second computer even on 1st try..

Am I doing or understanding something wrong?
--
If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users-/***@public.gmane.org
To unsubscribe from this group, send email to
symfony-users+unsubscribe-/***@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
Christophe COEVOET
2011-06-20 12:12:44 UTC
Permalink
Post by Inori
2 computers on LAN, web server on one of them, to which I have access
from both computers via 192.168.0.100.
Symfony2 which uses reverse proxy cache with e-tag.
app.php: http://pastebin.com/hupi9bYN
controller code: http://pastebin.com/7mWSt3jv
Caching itself works fine (I go to the page from one computer 1st
time: "200 OK" response; I refresh: "304 Not modifed").
After having my content cached via computer one, I try to open the
same page from second computer, but response is again "200 OK". The
way I understood reverse proxy is that it should return "304 Not
modified" for my second computer even on 1st try..
Am I doing or understanding something wrong?
No, it should not. It will send the page kept in the proxy cache
(without hitting your app) but it cannot return a 304 as the client does
not have the content yet so he needs it.
--
Christophe | Stof
--
If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users-/***@public.gmane.org
To unsubscribe from this group, send email to
symfony-users+unsubscribe-/***@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
Inori
2011-06-21 08:44:14 UTC
Permalink
Yeah, thanks, I realized this minutes after I sent the question.
In fact I tested this with a code like
if ($is_cached) {
return $response;
} else {
sleep(5);
// generate stuff for response here
}

When I launched this code on machine one, it slept for 5 secs like it
should since there was no cache ready, when I launched it on 2
machine, it returned the direct response immediately from cache.
Post by Christophe COEVOET
Post by Inori
2 computers on LAN, web server on one of them, to which I have access
from both computers via 192.168.0.100.
Symfony2 which uses reverse proxy cache with e-tag.
app.php:http://pastebin.com/hupi9bYN
controller code:http://pastebin.com/7mWSt3jv
Caching itself works fine (I go to the page from one computer 1st
time: "200 OK" response; I refresh: "304 Not modifed").
After having my content cached via computer one, I try to open the
same page from second computer, but response is again "200 OK". The
way I understood reverse proxy is that it should return "304 Not
modified" for my second computer even on 1st try..
Am I doing or understanding something wrong?
No, it should not. It will send the page kept in the proxy cache
(without hitting your app) but it cannot return a 304 as the client does
not have the content yet so he needs it.
--
Christophe | Stof
--
If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users-/***@public.gmane.org
To unsubscribe from this group, send email to
symfony-users+unsubscribe-/***@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
Loading...