Configuring HTTP Response Header Management
ROMA Connect provides flexible extension capabilities for APIs through plug-in policies. An HTTP response header management policy enables you to customize HTTP response headers that will be returned in an API response.
Plug-in policies and APIs are independent of each other. A plug-in policy takes effect for an API only after it is bound to the API. When binding a plug-in policy to an API, you must specify an environment where the API has been published. The plug-in policy takes effect for the API only in the specified environment.
Constraints
- An API can be bound to only one plug-in policy of the same type in the same environment. A plug-in policy that has been bound to an API cannot be deleted.
- The system response headers (such as x-apig-* and x-request-id) cannot be modified.
- The response headers for CORS cannot be modified.
Creating an HTTP Response Header Management Policy
- Log in to the ROMA Connect console. On the Instances page, click View Console next to a specific instance.
- In the navigation pane on the left, choose API Connect > API Policies. On the Policies tab, click Create Policy.
- On the Select Policy Type page, select HTTP Response Header Management in the Plug-ins area.
- On the page displayed, configure plug-in policy information.
Table 1 Policy configuration Parameter
Description
Name
Enter a policy name. Using naming rules facilitates future search.
Type
Fixed as HTTP Response Header Management.
Scope
Specify the scope to view the policy.
- Integration application: Each policy belongs to an integration application. Only users who have the permission on the integration application can view and use the policy.
- All: All users in the current instance can view and use the policy.
Integration Application
Mandatory for Scope set to Integration application.
Select an integration application for the policy. If none is available, click Create Integration Application on the right to create one.
Description
Describe the policy.
Policy Content: Configure the policy in a form or script. For details about how to configure a script, see Script Configuration Example.
Response Headers
Click Add Response Header to add a response header.
- Name: name of the response header, which is case-insensitive and must be unique within a plug-in.
- Value: value of the response header. This parameter does not take effect and is left blank if you set Action to Delete.
- Action: operation of the response header. You can override, append, delete, skip, or add the specified header.
- Override
- The value of this response header will override that of the same header that exists in an API response.
If an API response contains multiple headers with the same name as the one you set here, only the value of the specified header will be returned.
- If an API response does not contain the specified header, the value you set here will be returned.
- Append
- If an API response contains the specified header, the value you set here will be added, following the existing value. The two values will be separated with commas (,).
- If an API response contains multiple headers with the same name as the one you set here, values of these headers will be separated with commas (,) and followed by the value of the specified header.
- If an API response does not contain the specified header, the value you set here will be returned.
- Delete
- If an API response contains the specified header, the header will be deleted.
- If an API response contains multiple headers with the same name as the one you set here, all these headers will be deleted.
- Skip
- If an API response contains the specified header, the header will be skipped.
- If an API response contains multiple headers with the same name as the one you set here, values of all these headers will be returned without modification.
- If an API response does not contain the specified header, the value you set here will be returned.
- Add
The value of the specified header will be returned even if the header does not exist in an API response.
- Override
- Click OK.
After a plug-in policy is created, perform Binding a Plug-in Policy to an API for the policy to take effect for the API.
Binding a Plug-in Policy to an API
- On the Policies tab, filter policies by HTTP Response Header Management.
- Click the name of a policy to go to the details page.
- On the APIs tab, select the environment of the APIs you want to bind the policy to and click Bind to APIs.
- On the page displayed, select the APIs to bind the policy to.
- Click OK.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot