Reference documentation and code samples for the Compute V1 Client class HttpRedirectAction.
Specifies settings for an HTTP redirect.
Generated from protobuf messagegoogle.cloud.compute.v1.HttpRedirectAction
Namespace
Google \ Cloud \ Compute \ V1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ host_redirect
string
The host that is used in the redirect response instead of the one that was supplied in the request. The value must be from 1 to 255 characters.
↳ https_redirect
bool
If set to true, the URL scheme in the redirected request is set to HTTPS. If set to false, the URL scheme of the redirected request remains the same as that of the request. This must only be set for URL maps used in TargetHttpProxys. Setting this true for TargetHttpsProxy is not permitted. The default is set to false.
↳ path_redirect
string
The path that is used in the redirect response instead of the one that was supplied in the request. pathRedirect cannot be supplied together with prefixRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect. The value must be from 1 to 1024 characters.
↳ prefix_redirect
string
The prefix that replaces the prefixMatch specified in the HttpRouteRuleMatch, retaining the remaining portion of the URL before redirecting the request. prefixRedirect cannot be supplied together with pathRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect. The value must be from 1 to 1024 characters.
↳ redirect_response_code
string
The HTTP Status code to use for this RedirectAction. Supported values are: - MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. - FOUND, which corresponds to 302. - SEE_OTHER which corresponds to 303. - TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method is retained. - PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method is retained. Check the RedirectResponseCode enum for the list of possible values.
↳ strip_query
bool
If set to true, any accompanying query portion of the original URL is removed before redirecting the request. If set to false, the query portion of the original URL is retained. The default is set to false.
getHostRedirect
The host that is used in the redirect response instead of the one that was supplied in the request. The value must be from 1 to 255 characters.
Returns
Type
Description
string
hasHostRedirect
clearHostRedirect
setHostRedirect
The host that is used in the redirect response instead of the one that was supplied in the request. The value must be from 1 to 255 characters.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getHttpsRedirect
If set to true, the URL scheme in the redirected request is set to HTTPS. If set to false, the URL scheme of the redirected request remains the same as that of the request. This must only be set for URL maps used in TargetHttpProxys. Setting this true for TargetHttpsProxy is not permitted. The default is set to false.
Returns
Type
Description
bool
hasHttpsRedirect
clearHttpsRedirect
setHttpsRedirect
If set to true, the URL scheme in the redirected request is set to HTTPS. If set to false, the URL scheme of the redirected request remains the same as that of the request. This must only be set for URL maps used in TargetHttpProxys. Setting this true for TargetHttpsProxy is not permitted. The default is set to false.
Parameter
Name
Description
var
bool
Returns
Type
Description
$this
getPathRedirect
The path that is used in the redirect response instead of the one that was supplied in the request. pathRedirect cannot be supplied together with prefixRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect. The value must be from 1 to 1024 characters.
Returns
Type
Description
string
hasPathRedirect
clearPathRedirect
setPathRedirect
The path that is used in the redirect response instead of the one that was supplied in the request. pathRedirect cannot be supplied together with prefixRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect. The value must be from 1 to 1024 characters.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getPrefixRedirect
The prefix that replaces the prefixMatch specified in the HttpRouteRuleMatch, retaining the remaining portion of the URL before redirecting the request. prefixRedirect cannot be supplied together with pathRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect. The value must be from 1 to 1024 characters.
Returns
Type
Description
string
hasPrefixRedirect
clearPrefixRedirect
setPrefixRedirect
The prefix that replaces the prefixMatch specified in the HttpRouteRuleMatch, retaining the remaining portion of the URL before redirecting the request. prefixRedirect cannot be supplied together with pathRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect. The value must be from 1 to 1024 characters.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getRedirectResponseCode
The HTTP Status code to use for this RedirectAction. Supported values are: - MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. - FOUND, which corresponds to 302. - SEE_OTHER which corresponds to 303. - TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method is retained. - PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method is retained.
Check the RedirectResponseCode enum for the list of possible values.
Returns
Type
Description
string
hasRedirectResponseCode
clearRedirectResponseCode
setRedirectResponseCode
The HTTP Status code to use for this RedirectAction. Supported values are: - MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. - FOUND, which corresponds to 302. - SEE_OTHER which corresponds to 303. - TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method is retained. - PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method is retained.
Check the RedirectResponseCode enum for the list of possible values.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getStripQuery
If set to true, any accompanying query portion of the original URL is removed before redirecting the request. If set to false, the query portion of the original URL is retained. The default is set to false.
Returns
Type
Description
bool
hasStripQuery
clearStripQuery
setStripQuery
If set to true, any accompanying query portion of the original URL is removed before redirecting the request. If set to false, the query portion of the original URL is retained. The default is set to false.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Compute V1 Client - Class HttpRedirectAction (1.35.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.35.0 (latest)](/php/docs/reference/cloud-compute/latest/V1.HttpRedirectAction)\n- [1.34.0](/php/docs/reference/cloud-compute/1.34.0/V1.HttpRedirectAction)\n- [1.33.0](/php/docs/reference/cloud-compute/1.33.0/V1.HttpRedirectAction)\n- [1.32.0](/php/docs/reference/cloud-compute/1.32.0/V1.HttpRedirectAction)\n- [1.31.0](/php/docs/reference/cloud-compute/1.31.0/V1.HttpRedirectAction)\n- [1.30.0](/php/docs/reference/cloud-compute/1.30.0/V1.HttpRedirectAction)\n- [1.29.0](/php/docs/reference/cloud-compute/1.29.0/V1.HttpRedirectAction)\n- [1.28.0](/php/docs/reference/cloud-compute/1.28.0/V1.HttpRedirectAction)\n- [1.27.0](/php/docs/reference/cloud-compute/1.27.0/V1.HttpRedirectAction)\n- [1.26.0](/php/docs/reference/cloud-compute/1.26.0/V1.HttpRedirectAction)\n- [1.25.0](/php/docs/reference/cloud-compute/1.25.0/V1.HttpRedirectAction)\n- [1.24.0](/php/docs/reference/cloud-compute/1.24.0/V1.HttpRedirectAction)\n- [1.23.0](/php/docs/reference/cloud-compute/1.23.0/V1.HttpRedirectAction)\n- [1.22.1](/php/docs/reference/cloud-compute/1.22.1/V1.HttpRedirectAction)\n- [1.21.0](/php/docs/reference/cloud-compute/1.21.0/V1.HttpRedirectAction)\n- [1.20.0](/php/docs/reference/cloud-compute/1.20.0/V1.HttpRedirectAction)\n- [1.19.0](/php/docs/reference/cloud-compute/1.19.0/V1.HttpRedirectAction)\n- [1.18.1](/php/docs/reference/cloud-compute/1.18.1/V1.HttpRedirectAction)\n- [1.17.0](/php/docs/reference/cloud-compute/1.17.0/V1.HttpRedirectAction)\n- [1.16.2](/php/docs/reference/cloud-compute/1.16.2/V1.HttpRedirectAction)\n- [1.14.0](/php/docs/reference/cloud-compute/1.14.0/V1.HttpRedirectAction)\n- [1.13.0](/php/docs/reference/cloud-compute/1.13.0/V1.HttpRedirectAction)\n- [1.12.1](/php/docs/reference/cloud-compute/1.12.1/V1.HttpRedirectAction)\n- [1.11.1](/php/docs/reference/cloud-compute/1.11.1/V1.HttpRedirectAction)\n- [1.10.1](/php/docs/reference/cloud-compute/1.10.1/V1.HttpRedirectAction)\n- [1.9.1](/php/docs/reference/cloud-compute/1.9.1/V1.HttpRedirectAction)\n- [1.8.3](/php/docs/reference/cloud-compute/1.8.3/V1.HttpRedirectAction)\n- [1.7.1](/php/docs/reference/cloud-compute/1.7.1/V1.HttpRedirectAction)\n- [1.6.1](/php/docs/reference/cloud-compute/1.6.1/V1.HttpRedirectAction)\n- [1.5.0](/php/docs/reference/cloud-compute/1.5.0/V1.HttpRedirectAction) \nReference documentation and code samples for the Compute V1 Client class HttpRedirectAction.\n\nSpecifies settings for an HTTP redirect.\n\nGenerated from protobuf message `google.cloud.compute.v1.HttpRedirectAction`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Compute \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getHostRedirect\n\nThe host that is used in the redirect response instead of the one that was supplied in the request. The value must be from 1 to 255 characters.\n\n### hasHostRedirect\n\n### clearHostRedirect\n\n### setHostRedirect\n\nThe host that is used in the redirect response instead of the one that was supplied in the request. The value must be from 1 to 255 characters.\n\n### getHttpsRedirect\n\nIf set to true, the URL scheme in the redirected request is set to HTTPS. If set to false, the URL scheme of the redirected request remains the same as that of the request. This must only be set for URL maps used in TargetHttpProxys. Setting this true for TargetHttpsProxy is not permitted. The default is set to false.\n\n### hasHttpsRedirect\n\n### clearHttpsRedirect\n\n### setHttpsRedirect\n\nIf set to true, the URL scheme in the redirected request is set to HTTPS. If set to false, the URL scheme of the redirected request remains the same as that of the request. This must only be set for URL maps used in TargetHttpProxys. Setting this true for TargetHttpsProxy is not permitted. The default is set to false.\n\n### getPathRedirect\n\nThe path that is used in the redirect response instead of the one that was supplied in the request. pathRedirect cannot be supplied together with prefixRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect. The value must be from 1 to 1024 characters.\n\n### hasPathRedirect\n\n### clearPathRedirect\n\n### setPathRedirect\n\nThe path that is used in the redirect response instead of the one that was supplied in the request. pathRedirect cannot be supplied together with prefixRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect. The value must be from 1 to 1024 characters.\n\n### getPrefixRedirect\n\nThe prefix that replaces the prefixMatch specified in the HttpRouteRuleMatch, retaining the remaining portion of the URL before redirecting the request. prefixRedirect cannot be supplied together with pathRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect. The value must be from 1 to 1024 characters.\n\n### hasPrefixRedirect\n\n### clearPrefixRedirect\n\n### setPrefixRedirect\n\nThe prefix that replaces the prefixMatch specified in the HttpRouteRuleMatch, retaining the remaining portion of the URL before redirecting the request. prefixRedirect cannot be supplied together with pathRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect. The value must be from 1 to 1024 characters.\n\n### getRedirectResponseCode\n\nThe HTTP Status code to use for this RedirectAction. Supported values are: - MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. - FOUND, which corresponds to 302. - SEE_OTHER which corresponds to 303. - TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method is retained. - PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method is retained.\n\nCheck the RedirectResponseCode enum for the list of possible values.\n\n### hasRedirectResponseCode\n\n### clearRedirectResponseCode\n\n### setRedirectResponseCode\n\nThe HTTP Status code to use for this RedirectAction. Supported values are: - MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. - FOUND, which corresponds to 302. - SEE_OTHER which corresponds to 303. - TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method is retained. - PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method is retained.\n\nCheck the RedirectResponseCode enum for the list of possible values.\n\n### getStripQuery\n\nIf set to true, any accompanying query portion of the original URL is removed before redirecting the request. If set to false, the query portion of the original URL is retained. The default is set to false.\n\n### hasStripQuery\n\n### clearStripQuery\n\n### setStripQuery\n\nIf set to true, any accompanying query portion of the original URL is removed before redirecting the request. If set to false, the query portion of the original URL is retained. The default is set to false."]]