Using an SSI approach with set-cookie

skidaddytn nginx-forum at forum.nginx.org
Sat Oct 7 05:56:29 UTC 2017


I'm building a small set of configuration web pages in html/css with use of
virtual SSI to make FastCGI passes to our c++ application.   It works great
for adding dynamic content from the code, but since my fastcgi pass occurs
after the response header, I can't use set-cookie this way.  Now I could
move all HTML code into my app, but I'd rather not do this as I like to edit
it and test things in a browser with just the HTML file.

I came up with a strategy to allow use of cookies as follows:
1)  Use a location {} block #1 in nginx config to fastcgi pass everything to
my app
2)  location {} block #2 will check for (.html/.css/.jpg/etc) pages and grab
them from disk instead.

Using this method, I'm able to use set-cookie, and then do a 301 redirect to
an HTML file (which in turn includes the virtual SSI to call me back for
dynamic content).   i.e.   All of my <a href>  in the html will point at
pages with no extension  "/homepage".   Once I field the script request, i
can set-cookie then redirect to "/homepage.html".   

Seems to be working great so far.   But I wonder about how compatible this
approach may be per browser?

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,276750,276750#msg-276750



More information about the nginx mailing list