I recently inherited a wacky site with some hard-coded paths to CSS and JS in the files directory, but outside of where they're supposed to be.

Assuming that this isn't a security risk, could we add these file types to the /files/* redirection to the site's actual files directory?

Comments

colan created an issue. See original summary.

colan’s picture

Title: Allow rewriting of CSS and JS files from /files to site files directory » Allow Nginx rewriting of CSS and JS files from /files to actual location
Status: Active » Needs review
StatusFileSize
new2.25 KB
memtkmcc’s picture

I have no objections, other than any missing hits in this location will hit heavy Drupal backend for 404 instead of nginx fast 404 -- which is expected for location dedicated for images derivatives, but not for css/js.

memtkmcc’s picture

Ah, wait I have looked at the wrong lines apparently. It is outside of images derivatives sub-location, so OK.

memtkmcc’s picture

It is in a sub-location which includes fast 404 and the rewrite you are looking for, I think:

  rewrite  ^/files/(.*)$  /sites/$main_site_name/files/$1 last;
  try_files   $uri =404;
memtkmcc’s picture

Status: Needs review » Reviewed & tested by the community

RTBC

memtkmcc’s picture

@colan -- Please commit your patch! :)

  • colan committed 428bf48 on 7.x-3.x
    Issue #2825863 by colan: Added CSS and JS files to the list of those...
colan’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the review! Done.

Status: Fixed » Closed (fixed)

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