Azure Function Proxy (AZP) was meant for helping you to re-write your multitude of API URLs in a uniform fashion by the design of it, however it can be used for a rather unorthodox use case just as well.

Imagine you have two web resources you would like to get under one URL, with two path extensions – mapped to these web resources. As we live in a modern, mobile first world these web resources happen to be in AMP format.

So these two resources are a) one page from my pet blog log2talk.com as well as b) one from digiday.com. Now what I did with the help of AZP: create a new Proxy endpoint with route template and mapped the content origins to sub-paths of my Function endpoint. (Sounds a lot more complex than it really is, see screen caps below.)

This slideshow requires JavaScript.

And presto, your AZP will expose those resources to any path element you wish.

The pulled-through web content from the Guardian AMP page.
The pulled-through web content from the Guardian AMP page.
Bildschirmfoto 2017-07-23 um 20.51.25
The same for log2talk.com!

There are some caveats, however.

The origin URLs need to be fully descriptive in the sense that e.g. JavaScripts that are dependent are pointed to via fully qualified URLs and not only relative ones; and the proxied URL templates do require a trailing slash as it appears, URL would not work without. Maybe there is a trick for that, if so let me know please. Enjoy!

Advertisements