Location
property Location: string read write;
Example
procedure ScriptEvent(var Value: variant);
begin
if Response <> nil then
begin
Response.Location := '/status/example-123';
{ Configure the action's final outcome status consistently. }
Value := Response.Location;
end;
end;
Usage
Gets or sets the transmitted Location field without selecting or preserving a redirect or creation status code.
Additional Technical Info
Location maps directly to Indy's standard response field. A nonempty value is emitted as Location; an empty value omits it. Unlike Indy's separate redirect method, this property does not set StatusCode to 302 and performs no immediate send.
Use it with a final status whose semantics define Location—for example, a suitable 3xx redirect or 201 Created. In a normal Velox API action, the REST manager selects StatusCode after the script completes from the configured success/client/server outcome. A direct status assignment made by the script can be overwritten, so the action's configured result code must agree with this field.
The value is not parsed, resolved, normalised or checked against the request origin. HTTP permits a URI reference, which can be relative, but clients handle different statuses and schemes according to their own rules. Do not copy an untrusted Host, path or query directly into an absolute redirect: validate the destination against an allowlist to prevent open redirects and field injection.
Setting Location does not create a resource, alter routing, add a response body or prove that a client followed the reference. Avoid CR/LF and other control characters. Test Response for nil.
External references
Created 2026-07-15