2011年2月18日星期五

Re: Block access to every file in the site but index.htm

On 02/18/2011 10:59 AM, Edho P Arief wrote:
> On Fri, Feb 18, 2011 at 9:00 AM, atipico <nginx-forum@nginx.us> wrote:
>> I have a site with just one file: index.htm witch have some ajax linked
>> to php files. I'd like to make thouse php files only accessable via ajax
>> (post and get) coming from this index file and block access to all files
>> but the index.htm. Is it possible in Nginx? Thanks.
>>
> location = /index.htm {
> root ...
> ...
> }
>
> location / { return 404; }
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx
using ajax cannot get correct response either.
you can protect information by COOKIE:

location = /index.htm {
root ...
add_header Set-Cookie allow=true;
}
location / {
if ($COOKIE_allow = true ) {...}
return 404;
}

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

没有评论:

发表评论