Why doesn't a Location Redirection or User Authentication (On HTTP request) action work if I add it without a condition?
Short answer
Location Redirection and User Authentication (On HTTP request) are action types that require a condition; when they are saved with an empty Conditions field, TR7 configures them so that they run on no request. The form accepts a save without a condition and shows no warning. A condition that defines the traffic to be redirected for Location redirection, and a User Authentication condition that contains username and password pairs for User Authentication (On HTTP request), is added to the Conditions field of the action.
How Does It Work?
When these two types run without a condition, they affect all the traffic: a Location redirection without a condition redirects every request, and a User Authentication (On HTTP request) without a condition asks everyone for a password without a user list and cannot accept any login. To prevent this, TR7 disables these two types when they are saved without a condition.
| Conditions field of the action | Result |
|---|---|
| There is at least one condition | The action runs when the condition is met |
| Empty | The action runs on no request; if Hit Counter is on, the count does not increase either |
| The conditions were deleted later | Same as the empty state; the action does not run |
In the other action types, if the Conditions field is left empty, the action is applied to all the traffic; the only types that disable a save without a condition are these two.
Correct Setup in TR7
- A condition that defines the traffic to be redirected is selected (e.g. requests whose
Hostheader isexample.comwith the HTTP Header condition, or requests whose Path starts with/eski/). - If all the traffic is really to be redirected, the Always condition, which is available ready-made in the condition list, is selected. In this case, it is made sure that the target address does not return to the same vService; otherwise, a redirect loop occurs (how the redirect works).
User Authentication (On HTTP request)
- With Load Balancer → Conditions → Add, Criteria = User Authentication is selected, the Username-password Pairs are entered, and the condition is saved with Add.
- This condition is selected as it is (positive) in the Conditions field of the action; TR7 itself separates the unauthenticated requests and asks only them for a password.
- To protect only certain paths, the User authentication condition is combined with the other conditions with and (e.g. User authentication and Path starting with
/admin). - The default value of the Realm field is
Restricted; this text appears in the login window of the browser.
Difference from Redirect to HTTPS
Redirect to HTTPS is not one of the types that require a condition; it works when it is added without a condition, but it also redirects the requests that already come over HTTPS, and the browser enters a redirect loop. For this reason, the action is used with the If SSL is NOT terminated condition, which is available ready-made in the condition list (Redirect to HTTPS · Conditions).
Common Misconceptions
- "If it was saved, it works." The form accepts a save without a condition; if the Conditions column in the Actions list is empty, these two types run on no request.
- "Selecting Always in the User authentication (On HTTP request) action forces everyone to authenticate." Always does not carry a user list; everyone is asked for a password, but no login is accepted. A User authentication condition is required for authentication.
- "The negated form of the User authentication condition must be selected." The condition is selected in its positive form; TR7 itself separates the unauthenticated requests.
How it is done in the documentation
