You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Data processing
Combining redirection rules and image processing
Copy page
Download PDF
Combining redirection rules and image processing
This topic explains the use cases, notes and steps for integrating redirection rules with image processing.​
Notes​
It's best not to combine redirection rules with image processing because doing so requires two access attempts. If you wish to use these features together, refer to this document for the corresponding operations.​
Use cases​
  • Use TOS as a pseudo origin for CDN. Fetch images from the origin server and write them to TOS using redirection rules. Then, process the images using image processing parameters.​
  • During the business data migration, image distribution switched to TOS. However, the incremental images have not yet been migrated to TOS. Use TOS redirection rules to fetch these images from the origin server and write them to TOS. Then, process the images using image processing parameters.​
Prerequisites​
Ensure that the images in the origin server are publicly readable. For instructions on how to view and modify the storage type of an image file, Viewing object details and Changing object storage type.​
Step 1: Create a redirection rule​
  1. Log in to the TOS console.​
  1. In the left navigation pane, click Buckets. In the Buckets list, click the bucket you want to manage.​
  1. In the left navigation pane, select Basic configurations > Back-to-Origin rules.​
  1. On the Back-to-Origin rules page, click Create rule.​
  1. On the Create Back-to-Origin Rule page, configure the following parameters. For more information on other parameters, see Configuring redirection rules.​
  • ​
    Parameter​
    Description​
    Back-to-Origin method​
    Select Redirection.​
    Back-to-Origin condition​
    Configure the desired trigger conditions. A redirection action will only be triggered when all configured conditions are met simultaneously.​
    Back-to-Origin address​
    Configure the address to which TOS will redirect once the back-to-origin conditions are met. Depending on the situation, select either Add prefix and suffix, or Replace filename prefix. Do not select Redirect to fixed address.​
    Whether to carry request parameter for back-to-origin​
    Select whether to forward the query string from the request to the origin server. We recommend enabling Whether to carry request parameter for back-to-origin.​
    tip​
    When redirection rules are used with image processing, only parameters other than the TOS image processing parameters are forwarded to the origin server.​
    Whether to pull file from the origin server​
    When enabled, TOS first redirects to the origin server address, then fetches the object asynchronously in the background and writes it to TOS. We recommend enabling Whether to pull file from the origin server.​
    Whether to carry request parameter for file pull​
    Select whether to forward the query string from the request to the origin server. We recommend enabling Whether to carry request parameter for file pull.​
    tip​
    When redirection rules are used with image processing, only parameters other than the TOS image processing parameters are forwarded to the origin server.​
    Whether to redirect based on the origin server for async pull​
    Select whether to redirect the request based on the 3XX status code of the origin server. A request can only be redirected once. We recommend enabling Whether to redirect based on the origin server for async pull.​
    HTTP Header Delivery Rules​
    Select the rule for passing response headers when TOS accesses the specified origin server. We recommend selecting the option Transparently Transmit All HTTP Headers.​
    ​
  1. Click Submit.​
Step 2: Process an image using a URL​
  1. Obtain the endpoint of the bucket that contains the redirection rule. For more information on endpoints, see Regions and endpoints.​
  1. Obtain the parameters for image processing. For an overview of image processing parameters, see Image processing overview.​
  1. Enter the image processing URL into your browser to fetch the image from the origin server and write it to TOS. The URL format is https://<bucket name>.<endpoint>/<image name>?<image processing parameters> .​
  • For example:​
  • Bucket name: test.​
  • Endpoint: tos-cn-beijing.volces.com.​
  • Image name: abc.jpg.​
  • To proportionally scale the image to a height of 100, the image processing URL would be https://test.tos-cn-beijing.volces.com/abc.jpg?x-tos-process=image/resize,h_100.​
tip​
  • The first time an image is accessed, it will only be fetched, not processed.​
  • If the public access permission for your bucket is set to private, the image will also be private. To process a private image, use an SDK to generate a pre-signed URL that includes the image processing parameters.​
  1. Then, access the image URL, https://<bucket name>.<endpoint>/<image name>?<image processing parameters>, again to process the image.​
  • For example, access https://test.tos-cn-beijing.volces.com/abc.jpg?x-tos-process=image/resize,h_100 again to resize the image.​
​
Last updated: 2026.08.25 10:39:45