Recall & Review
beginner
What does the
last flag do in an nginx rewrite rule?The
last flag stops processing the current set of rewrite directives and restarts the location search with the new URI. It is like telling nginx to start fresh with the rewritten URL.Click to reveal answer
beginner
Explain the purpose of the
break flag in nginx rewrite rules.The
break flag stops processing further rewrite directives in the current location block but does not restart the location search. It keeps nginx in the current location with the rewritten URI.Click to reveal answer
intermediate
What is the difference between
redirect and permanent flags in nginx rewrites?Both
redirect and permanent send an HTTP redirect to the client. redirect sends a temporary 302 redirect, while permanent sends a permanent 301 redirect.Click to reveal answer
intermediate
When should you use the
permanent flag in nginx rewrite rules?Use
permanent when you want to tell browsers and search engines that the resource has moved permanently to a new URL. This helps with SEO and caching.Click to reveal answer
beginner
What happens if you omit flags in an nginx rewrite directive?
If you omit flags, nginx uses the default behavior which is similar to
last. It restarts the location search with the rewritten URI.Click to reveal answer
Which nginx rewrite flag restarts the location search with the new URI?
✗ Incorrect
The
last flag tells nginx to stop processing current rewrites and restart location search with the rewritten URI.What HTTP status code does the
permanent flag send?✗ Incorrect
The
permanent flag sends a 301 status code indicating a permanent redirect.Which flag stops rewrite processing but does NOT restart location search?
✗ Incorrect
The
break flag stops further rewrite processing in the current location without restarting location search.What is the default behavior if no flag is specified in a rewrite directive?
✗ Incorrect
If no flag is given, nginx behaves like
last, restarting location search with the rewritten URI.Which flag sends a temporary redirect to the client?
✗ Incorrect
The
redirect flag sends a 302 temporary redirect to the client.Describe the behavior and use cases of each nginx rewrite flag: last, break, redirect, and permanent.
Think about how nginx handles the rewritten URL and what response it sends to the client.
You got /4 concepts.
Explain why you might choose the 'break' flag over 'last' in an nginx rewrite rule.
Consider how nginx processes location blocks after rewriting.
You got /4 concepts.