Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

What are your link strategies for Express apps in Hosted Targets ?

The overiew promises ..."You can debug and test your app locally before deploying it and be assured that the deployed version will work exactly as it does locally". And so it mostly does - until your NodeJS application is an Express App that serves static or rendered resources as well as relative links.

Then the deployed basepath of the proxy is a problem, such as when your page may redirect to a resource such as href="https://community.apigee.com/login".
Locally this runs fine, because your server host is root, and "http://localhost:8080/login" is found.
Once in Apigee HT, the link is effectively "https://yourorg-test.apigee.net/login" ...
whereas the desired root is actually "https://yourorg-test.apigee.net/basepath/login".

  1. My current workaround is ... examine response payload and adjust links to insert the basepath.
    This is any css, html, .js and also the "location" header for redirects.
    Messy and error-prone - after every apigeetool deploy, I must add these policies.

2. Do we have access to the .htaccess file and would that even help ?

3. Are code changes preferred for my users .... including css image links ?

4. What about redirects to 3rd-party IDP pages ?

What are your recommendations and other bright ideas ?

0 6 330
6 REPLIES 6