Closed (fixed)
Project:
Octopus
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Feb 2012 at 02:21 UTC
Updated:
24 Mar 2013 at 18:20 UTC
I'm trying to setup endpoints that have .json at the end of the url
ie. mydomain.com/node/2.json
is there something in barracuda's nginx config that would prevent that?
i keep getting 404's
the only thing i found so far was a rule to make .json requests boost compatible that looks like this
###
### Make json compatible with boost caching.
###
location ~* \.json$ {
if ( $request_method = POST ) {
return 405;
}
if ( $cache_uid ) {
return 405;
}
error_page 405 = @uncached;
access_log off;
tcp_nodelay off;
expires max; ### if using aggregator
add_header X-Header "Boost Citrus 2.3";
try_files /cache/$device/$host${uri}_.json $uri =404;
}any tips are greatly appreciated!
Comments
Comment #1
omega8cc commentedYou need to add your own location, as explained in the how-to: http://drupalcode.org/project/barracuda.git/blob/HEAD:/docs/HINTS.txt#l16
It is now supported both in the Master and Satellite instances, just the path to the custom include is different. In Octopus it is: http://drupalcode.org/project/barracuda.git/blob/HEAD:/aegir/conf/nginx_... while in Barracuda it is
include /var/aegir/config/server_master/nginx/post.d/nginx_vhost_include*;.Your custom location should probably look like below:
Comment #3
omega8cc commentedWe should support this out of the box, so non-static requests ending with
.jsonwill be sent to@drupallocation instead of generate=404.Comment #4
omega8cc commentedCommitted in http://drupalcode.org/project/octopus.git/commit/09dc791
Comment #5
7wonders commented#4 confirmed as working :)
Comment #7
webmasterkai commentedDoesn't this prevent serving static json files even if they are in the sites/[domain]/files directory? It also skips the fast 404 if the static json file isn't found in the sites/[domain]/files directory.
Comment #8
omega8cc commented1. No, it doesn't break anything for any existing static files, because still $uri is checked first.
2. Yes, it no longer gives fast 404 for non-existing .json files, but that is the price here.
Also, if you have a problem with this and you think you have a better solution, please open a new issue and reference this one, because this one is fixed.
Comment #9
webmasterkai commentedThanks for the quick response. I must be misunderstanding something. I don't seem to be able to request static .json files that exists on the server. Are .json files not allowed?
Comment #10
omega8cc commented@webmasterkai - If you have any problem with .json files/requests, try to debug it first (because it should just work) and then feel free to open a new issue. Thanks.
Comment #11
omega8cc commentedHmm, after looking at this again, I think we have a problem, indeed. Sorry for too fast and wrong response :/
This:
will skip the check for static files existence for all logged in users, because it sends the requests to @drupal location directly. That is why static .json files may work only for not logged in visitors.
Comment #12
webmasterkai commentedThanks for the quick reply again. I was just about to open a new issue. :-)
I can confirm that the following example works for anonymous users but not authenticated users:
http://json.o4892985044.v94d.dal.host8.biz/sites/json.o4892985044.v94d.d...
Example of a static text file that works for both authenticated and anonymous:
http://json.o4892985044.v94d.dal.host8.biz/sites/json.o4892985044.v94d.d...
Comment #13
omega8cc commentedIt was a bit tricky, but is now fixed in HEAD:
http://drupalcode.org/project/octopus.git/commit/90f119b
http://drupalcode.org/project/octopus.git/commit/5ad4119
All patches have been applied and tested on your instance, so we know it works.
Thanks!