0

I'm trying to implement the following rule:

location ~ ^/stylesheets|javascripts|assets/ 

However it's matching against:

mysite.com/something/something/javascripts

My thought was this simple regex would only match.

mysite.com/javascripts

I want it to ignore nesting, what is wrong here?

1
  • Can you post your whole set of location rules please? Commented May 14, 2012 at 15:42

1 Answer 1

3

You have to group the OR'ed expression: ^/(stylesheets|javascripts|assets)/

Otherwise you'd have three slightly different potential matches:

  1. Any path starting with /stylesheets,
  2. Any path containing javascripts somewhere and
  3. Any path containing assets/ anywhere.
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! this is what I was missing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.