I am trying to set up a content deployment flow, and part of that means 'PUT' to a url provided by Drupal Services module (I'm using their REST services). However, Nginx doesn't like PUT to non static files, I gather.

Where can I let nginx know about Drupal Services urls, and would I have to add the configuration lines piecemeal (one per URL I would like to allow)?

Here is the URL I'm PUTting to:
http://myurl.com/services/rest/file/f3a3a19a-6081-4845-bc9a-58dfe93304e8...

The request has the Session id stored in the 'Cookie' key in the header (I'm using Deploy which does that for me). The payload looks like a JSON encoded file, as expected.

Here is what Nginx sends back:

<html>
<head><title>405 Not Allowed</title></head>
<body bgcolor="white">
<center><h1>405 Not Allowed</h1></center>
<hr><center>nginx</center>
</body>
</html>

Comments

omega8cc’s picture

Status: Active » Postponed (maintainer needs more info)

Please follow submission guidelines, since we don't even know the BOA version you run. We don't block PUT requests on the Nginx level and I don't see any reason why Nginx would respond like that.

omega8cc’s picture

Category: support » bug
Status: Postponed (maintainer needs more info) » Active

Hmm, we have location like this:

###
### Make json compatible with boost caching but dynamic for POST requests.
###
location ~* \.json$ {
  if ( $request_method = POST ) {
    return 418;
  }
  if ( $cache_uid ) {
    return 405;
  }
  error_page  405 = @uncached;
  error_page  418 = @drupal;
  access_log  off;
  tcp_nodelay off;
  expires     max; ### if using aggregator
  add_header  X-Header "Boost Citrus 2.3";
  try_files   /cache/normal/$host${uri}_.json $uri =404;
}

We do this to both support fast static requests and POST dynamic requests, but we should probably do this like this, to send PUT requests to Drupal:

###
### Make json compatible with boost caching but dynamic for POST requests.
###
location ~* \.json$ {
  if ( $request_method = POST ) {
    return 418;
  }
  if ( $request_method = PUT ) {
    return 418;
  }
  if ( $cache_uid ) {
    return 405;
  }
  error_page  405 = @uncached;
  error_page  418 = @drupal;
  access_log  off;
  tcp_nodelay off;
  expires     max; ### if using aggregator
  add_header  X-Header "Boost Citrus 2.3";
  try_files   /cache/normal/$host${uri}_.json $uri =404;
}
omega8cc’s picture

Status: Active » Fixed
diwant’s picture

Status: Fixed » Closed (works as designed)

Thanks, I see how you did that.

After posting I read that caching/Boost may be complaining about PUT to static files and so I set my Deploy endpoint to "/?q=services/rest" instead of "/services/rest" and that fixed the 405 error.

I think it actually makes sense the way you have it now, PUT on a static file seems bad for caching.

diwant’s picture

Lol just saw you fixed it in a commit as well. I'll let you maintain this issue as you please.

omega8cc’s picture

Status: Closed (works as designed) » Fixed

OK, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.