tl;dr if you hit http://pearsonbuild-staging.apigee.net/performance-insights directly (this is the link on the apigee page), it gets forwarded to nginx as a request to / root. The browser has no way of knowing that /performance-insights is the root, so it tries to load the resources from http://pearsonbuild-staging.apigee.net/<resource>. If you use http://pearsonbuild-staging.apigee.net/performance-insights/ (with a trailing slash) the browser uses relative pathing to load the resources as http://pearsonbuild-staging.apigee.net/performance-insights/<resource>. Since the nginx only sees a hit to http://pearsonbuild-staging.apigee.net/, it does not do a redirect, like it would if you just typed http://pearsonbuild-staging.apigee.net. So the redirect must happen in Apigee to reset the browser root. ie, user hits http://pearsonbuild-staging.apigee.net/performance-insights, apigee says 301 http://pearsonbuild-staging.apigee.net/performance-insights/ with a trailing slash, browser then loads the correct root path.
ok, to do that, you could first create a RaiseFault Policy like this,
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <RaiseFault async="false" continueOnError="false" enabled="true" name="Raise-Fault"> <DisplayName>Raise Fault</DisplayName> <Properties/> <FaultResponse> <Set> <Headers> <Header name="Location">/performance-insights/</Header> </Headers> <Payload contentType="text/plain"> </Payload> <StatusCode>301</StatusCode> <ReasonPhrase>Redirect</ReasonPhrase> </Set> </FaultResponse> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> </RaiseFault>
Attach it in the preflow request like this,
<PreFlow name="PreFlow"> <Request> <Step> <Condition>proxy.pathsuffix = ""</Condition> <Name>Raise-Fault</Name> </Step> </Request> <Response/> </PreFlow>
So, now when the proxy pathsuffix is empty then we can redirect to performance-insights/
Thanks,