Performing HTTP 302 redirects in a published service policy
search cancel

Performing HTTP 302 redirects in a published service policy

book

Article ID: 46921

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

The HTTP 302 Found status code allows a server application to specify an alternate location for a document or service.

Environment

All supported versions of the API Gateway

Cause

A user agent that receives an HTTP 302 with a valid Location header should be able to resend the HTTP request to the URL specified in said header. According to the RFC section for the Location header--The value of the Location header must be an absolute URL.

Resolution

  1. Add a 'Return Template Response to Requestor' assertion to your policy specifying 302 for the Response HTTP Status field

  1. Add a Manage Transport Properties assertion to your policy specifying the Property/Header Nameas Location and Property/Header Value as the target URL.

In the below example, you will be redirected to http://server.example.com/service

  1. Once complete your policy should look as follows: