Managing HTTP Redirects
The HTTP Redirect service allows you to redirect HTTP traffic to another URL.
You can use HTTP Redirect to:
- Redirect all HTTP traffic for an entire zone to another zone. For example, if a company owns example.net and example.com, HTTP Redirect lets the company redirect all HTTP traffic for example.net to example.com. This is a one-to-one mapping; wildcards are not supported.
- Redirect a specific subdomain to an HTTP URL. For example, test.example.com can be redirected to http://example.net/test/test.php.
- Redirect a subdomain to a URL with a port number. For example, camera.example.com can be redirected to http://office.example.com:8080 so a user can view their camera system without typing in the port number each time.
- Permanently redirect a domain name that has been deprecated by displaying a 301 response code. Permanently redirecting a domain name informs search engines and browsers what to do with the information.
After you create the redirect, you are issued a CNAME record for
redirect.waf.oci.oraclecloud.net
. You must add this record to the originating DNS zone for the redirect to work.Required IAM Policies
To use Oracle Cloud Infrastructure, you must be granted security access in a policy by an administrator. This access is required whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you get a message that you don’t have permission or are unauthorized, verify with your administrator what type of access you have and which compartment to work in.
A policy like this allows a specific group to manage HTTP redirects:
Allow group <GroupName> to manage http-redirects in compartment <CompartmentName>
If you're new to policies, see Getting Started with Policies and Common Policies. For more details about policies for HTTP Redirect, see DNS Policy Reference.
Using the Console
- Open the navigation menu and click Networking. Under DNS management, click HTTP Redirects.
- Click Create HTTP Redirect.
- In the Create Redirect dialog box, enter the following information:
- Name: (Optional) Enter the name of the redirect zone you want to create. Avoid entering confidential information.
- Select a Zone: (Optional) Select a zone from a list of configured zones. If the Create DNS Record check box is selected, the zone will be used to build an alias record for the redirect.
- Domain: Enter the domain name from which traffic is redirected.
- Target - Enter the following information for the endpoint where the traffic will be redirected:
- Protocol: The network protocol used to interact with the target.
- Host: The hostname of the target.
- Port: (Optional) The port used to connect to the endpoint. The default is 80 for HTTP and 443 for HTTPS.
- Path: (Optional) The specific path on the target for the redirect. A value of {path} will copy the path from the incoming request.
- Query: (Optional) The query component of the target URL (for example, "?redirected" in "https://target.example.com/path/to/resource?redirected"). Use of the "\" character is not permitted except to escape a following "\", "{", or "}". An empty value results in a redirection target URL with no query component. A static value must begin with a leading "?", optionally followed by other query characters. A request-copying value must exactly match "{query}", and will be replaced with the query component of the request URL (including a leading "?" if the request URL includes a query component).
- Response Code: The response code that is returned with the redirect. If your website was permanently moved to the redirection URL and you want it to be indexed by search engines, select 301 - Moved Permanently. If you want to indicate that the URL has been temporarily changed to a different address, select 302 - Found.
- Create DNS Record: Select this check box to create an associated ALIAS record for the redirect in the specified zone. If a record for the zone specified already exists, the DNS record will not be created.
- ALIAS TTL in Seconds - The Time to Live for the ALIAS record before a new ALIAS record is retrieved. The default value is 300.
- Tags: If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you are not sure whether to apply tags, skip this option (you can apply tags later) or ask your administrator.
- Click Create. The redirect zone is added to the redirects list.
- Open the navigation menu and click Networking. Under DNS management, click HTTP Redirects.
- Click the name of a redirect zone.
- Click Edit.
-
In the Edit Redirect dialog box, make the needed changes and then click Save Changes.
- Open the navigation menu and click Networking. Under DNS management, click HTTP Redirects.
- Select a redirect zone.
- Click Delete.
-
In the Delete Resource dialog box, click Delete HTTP Redirect. Any attached records will need to be managed in DNS Zone Management.
- Open the navigation menu and click Networking. Under DNS management, click HTTP Redirects.
-
Click the name of a redirect zone.
- Click Move Resource.
- Choose the destination compartment from the list.
- Click Move Resource.
Using the API
Use the following operations to manage your HTTP redirect zones: