Play with Proxy in Azure Function App

Published Aug 24 2021 09:59 PM 3,240 Views
Microsoft

KevinLi_0-1627964796921.png

 

Proxy in Azure Function App is often used for specifying endpoints on your function app that are implemented by another resource. You can use these proxies to break a large API into multiple function apps (as in a microservice architecture), while still presenting a single API surface for clients. It acts like an API management in this way. It can also be used as a web proxy to redirect third-party website. Let's discover more interesting ways to play with it.

 

1. Mocking functions:

This is one of the most typical usages. There is no need to write the real code to get a customized response code, status and body. Within the function app, we can go ahead to Proxies and add a new proxy rule like as below easily:

KevinLi_5-1629296284982.png

 

Then we can test the result by sending GET/POST request to our defined endpoint using web browser or tools like Postman:

KevinLi_6-1629296284984.png

 

2. Refer endpoint in another resource:

We can specify an endpoint within current function app that are implemented by another resource e.g. function app by putting remote endpoint into the Backend URL, in below sample, when we hit https://yourfunctionapp.azurewebsites.net/api/HttpTrigger1, the proxy will hit https://anotherfunctionapp.azurewebsites.net/api/HttpTrigger1 in the backend. Also, if we put localhost in the backend URL, it is able to reach out to the API running in our local machine.

KevinLi_7-1629296284972.png

 

3. Transfer parameters:

Sometimes we would need to transfer some parameters like name or API key.

There are two ways:

  • Using route template, such as /api/HttpTrigger1/{name}, the parameter names are enclosed in braces {}.

KevinLi_8-1629296284973.png

  • Use request override to hardcode the parameter.

It is very useful when the remote endpoint requires an API key and we want it to be passed automatically and secretly without exposing it. In request override, we can add a query and put the key in plaintext there. But it is recommended to store these keys in application settings and referencing those in proxies for security reason. We can put the key in configuration and use symbol % to refer it, for example %apikey%.

KevinLi_9-1629296284975.png

 

4. Web Proxy:

  • Used as web proxy to show a single static page.

For example, we can set Route template to /bing and Backend URL to https://www.bing.com. Then we will get static homepage of remote website when access https://yourfunctionapp.azurewebsites.net/bing.

  • Proxy for all content from remote endpoint.

We can use wildcard in route template, such as /{*any} to represent the remaining path segments from the incoming request. The string is not fixed, you can also use {*dog}, {*cat} or anything you like.

KevinLi_0-1629358390440.png

  • Proxy for sub path

Sometimes you may notice the remote endpoint is using sub-path to get static files like pictures or JavaScript files. We can set proxy for them as well.

KevinLi_2-1629358655727.png

 

5. Advanced mode:

We can also manually edit proxies.json file and deploy it as part of our app when we use any of the deployment methods that Functions supports.

KevinLi_12-1629296284985.png

 

6. Disable local call

By default, Functions proxies use a shortcut to send API calls from proxies directly to functions in the same function app. This shortcut is used instead of creating a new HTTP request. We can disable that shortcut behavior by setting AZURE_FUNCTION_PROXY_DISABLE_LOCAL_CALL to true in application settings.

 

7. Decode slashes in backend URL

When AZURE_FUNCTION_PROXY_BACKEND_URL_DECODE_SLASHES is set to true, the URL example.com/api%2ftest resolves to example.com/api/test. By default, the URL remains unchanged as example.com/test%2fapi.

 

8. Introduction Video:

Below is our Azure Friday on Azure Function Proxies.

 

Thanks for reading this post. I hope you enjoyed it. Please feel free to write your comments and views about the same over here.

3 Comments
Visitor

Thanks Kevin, that is really handy.

I am now engaged in multiple tasks around the function proxy, and lately, our QA team noticed a bug related to how function proxy is dealing with cookies.

we noticed that the proxy merges multiple cookie headers into one (the 1st cookie ). so not sure if we could sort this out somehow. we are using V3 function

 

Visitor

A quick update on my last comment about the Cookies issue. we managed to fix that by downgrade the function runtime version to V 1 instead of v3, and now we can see all the cookies as they should be

OmarRob_0-1630029582235.png

 

 

Microsoft

Hi @OmarRob, I did not notice the change in their handling of cookies before. Thanks for sharing the update with me!

%3CLINGO-SUB%20id%3D%22lingo-sub-2614677%22%20slang%3D%22en-US%22%3EPlay%20with%20Proxy%20in%20Azure%20Function%20App%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2614677%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22KevinLi_0-1627964796921.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F300060iBB51C01FE45B444A%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22KevinLi_0-1627964796921.png%22%20alt%3D%22KevinLi_0-1627964796921.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-functions%2Ffunctions-proxies%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EProxy%20in%20Azure%20Function%20App%3C%2FA%3E%26nbsp%3Bis%20often%20used%20for%26nbsp%3Bspecifying%20endpoints%20on%20your%20function%20app%20that%20are%20implemented%20by%20another%20resource.%20You%20can%20use%20these%20proxies%20to%20break%20a%20large%20API%20into%20multiple%20function%20apps%20(as%20in%20a%20microservice%20architecture)%2C%20while%20still%20presenting%20a%20single%20API%20surface%20for%20clients.%20It%20acts%20like%20an%20API%20management%20in%20this%20way.%20It%20can%20also%20be%20used%20as%20a%20web%20proxy%20to%20redirect%20third-party%20website.%20Let's%26nbsp%3Bdiscover%20more%20interesting%20ways%20to%20play%20with%20it.%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E1.%20Mocking%20functions%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EThis%20is%20one%20of%20the%20most%20typical%20usages.%20There%20is%20no%20need%20to%20write%20the%20real%20code%20to%26nbsp%3Bget%20a%20customized%20response%20code%2C%20status%20and%20body.%20Within%20the%20function%20app%2C%20we%20can%20go%20ahead%20to%20Proxies%20and%20add%20a%20new%20proxy%20rule%20like%20as%20below%20easily%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22KevinLi_5-1629296284982.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F304092i6D0E5B086EF6B559%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22KevinLi_5-1629296284982.png%22%20alt%3D%22KevinLi_5-1629296284982.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EThen%20we%20can%20test%20the%20result%20by%20sending%20GET%2FPOST%20request%20to%20our%20defined%20endpoint%20using%20web%20browser%20or%20tools%20like%20Postman%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22KevinLi_6-1629296284984.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F304093i83C92C63442583B7%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22KevinLi_6-1629296284984.png%22%20alt%3D%22KevinLi_6-1629296284984.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E2.%20Refer%20endpoint%20in%20another%20resource%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EWe%20can%20specify%20an%20endpoint%20within%20current%20function%20app%20that%20are%20implemented%20by%20another%20resource%20e.g.%20function%20app%20by%20putting%20remote%20endpoint%20into%20the%20Backend%20URL%2C%20in%20below%20sample%2C%20when%20we%20hit%20%3CA%20href%3D%22https%3A%2F%2Fyourfunctionapp.azurewebsites.net%2Fapi%2FHttpTrigger1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fyourfunctionapp.azurewebsites.net%2Fapi%2FHttpTrigger1%3C%2FA%3E%2C%26nbsp%3Bthe%20proxy%20will%20hit%20%3CA%20href%3D%22https%3A%2F%2Fanotherfunctionapp.azurewebsites.net%2Fapi%2FHttpTrigger1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fanotherfunctionapp.azurewebsites.net%2Fapi%2FHttpTrigger1%3C%2FA%3E%26nbsp%3Bin%20the%20backend.%20Also%2C%20if%20we%20put%20localhost%20in%20the%20backend%20URL%2C%20it%20is%20able%20to%20reach%20out%20to%20the%20API%20running%20in%20our%20local%20machine.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22KevinLi_7-1629296284972.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F304091i5ECEC902B87BE07A%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22KevinLi_7-1629296284972.png%22%20alt%3D%22KevinLi_7-1629296284972.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E3.%20Transfer%20parameters%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3ESometimes%20we%20would%20need%20to%20transfer%20some%20parameters%20like%20name%20or%20API%20key.%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EThere%20are%20two%20ways%3A%3C%2FP%3E%0A%3CUL%20style%3D%22direction%3A%20ltr%3B%20unicode-bidi%3A%20embed%3B%20margin-top%3A%200in%3B%20margin-bottom%3A%200in%3B%22%20type%3D%22disc%22%3E%0A%3CLI%20style%3D%22margin-top%3A%200%3B%20margin-bottom%3A%200%3B%20vertical-align%3A%20middle%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EUsing%26nbsp%3Broute%20template%2C%20such%20as%20%2Fapi%2FHttpTrigger1%2F%7Bname%7D%2C%20the%20parameter%20names%20are%20enclosed%20in%20braces%20%7B%7D.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22KevinLi_8-1629296284973.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F304095iFB9B419BBAED7588%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22KevinLi_8-1629296284973.png%22%20alt%3D%22KevinLi_8-1629296284973.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%20style%3D%22direction%3A%20ltr%3B%20unicode-bidi%3A%20embed%3B%20margin-top%3A%200in%3B%20margin-bottom%3A%200in%3B%22%20type%3D%22disc%22%3E%0A%3CLI%20style%3D%22margin-top%3A%200%3B%20margin-bottom%3A%200%3B%20vertical-align%3A%20middle%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EUse%20request%20override%20to%20hardcode%20the%20parameter.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EIt%20is%20very%20useful%20when%20the%20remote%20endpoint%20requires%20an%20API%20key%20and%20we%20want%20it%20to%20be%20passed%20automatically%20and%20secretly%20without%20exposing%20it.%20In%20request%20override%2C%20we%20can%20add%20a%20query%20and%20put%20the%20key%20in%20plaintext%20there.%20But%20it%20is%20recommended%20to%20store%20these%20keys%20in%20application%20settings%20and%20referencing%20those%20in%20proxies%20for%20security%20reason.%26nbsp%3BWe%20can%20put%20the%20key%20in%20configuration%20and%20use%20symbol%20%25%20to%20refer%20it%2C%20for%20example%20%25apikey%25.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22KevinLi_9-1629296284975.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F304094i4D1F61A0EE4D45D4%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22KevinLi_9-1629296284975.png%22%20alt%3D%22KevinLi_9-1629296284975.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E4.%20Web%20Proxy%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%20style%3D%22direction%3A%20ltr%3B%20unicode-bidi%3A%20embed%3B%20margin-top%3A%200in%3B%20margin-bottom%3A%200in%3B%22%20type%3D%22disc%22%3E%0A%3CLI%20style%3D%22margin-top%3A%200%3B%20margin-bottom%3A%200%3B%20vertical-align%3A%20middle%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EUsed%20as%20web%20proxy%20to%20show%26nbsp%3Ba%20single%20static%20page.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%20data-unlink%3D%22true%22%3EFor%20example%2C%20we%20can%20set%20Route%20template%20to%20%2Fbing%20and%20Backend%20URL%20to%20%3CA%20href%3D%22https%3A%2F%2Fwww.bing.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.bing.com%3C%2FA%3E.%26nbsp%3BThen%20we%20will%20get%20static%20homepage%20of%20remote%20website%20when%20access%20https%3A%2F%2Fyourfunctionapp.azurewebsites.net%2Fbing.%3C%2FP%3E%0A%3CUL%20style%3D%22direction%3A%20ltr%3B%20unicode-bidi%3A%20embed%3B%20margin-top%3A%200in%3B%20margin-bottom%3A%200in%3B%22%20type%3D%22disc%22%3E%0A%3CLI%20style%3D%22margin-top%3A%200%3B%20margin-bottom%3A%200%3B%20vertical-align%3A%20middle%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EProxy%20for%20all%20content%20from%20remote%20endpoint.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EWe%20can%20use%20wildcard%20in%20route%20template%2C%20such%20as%20%2F%7B*any%7D%20to%20represent%20the%20remaining%20path%20segments%20from%20the%20incoming%20request.%20The%20string%20is%20not%20fixed%2C%20you%20can%20also%20use%20%7B*dog%7D%2C%20%7B*cat%7D%20or%20anything%20you%20like.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22KevinLi_0-1629358390440.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F304334i798506480008A8FC%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22KevinLi_0-1629358390440.png%22%20alt%3D%22KevinLi_0-1629358390440.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%20style%3D%22direction%3A%20ltr%3B%20unicode-bidi%3A%20embed%3B%20margin-top%3A%200in%3B%20margin-bottom%3A%200in%3B%22%20type%3D%22disc%22%3E%0A%3CLI%20style%3D%22margin-top%3A%200%3B%20margin-bottom%3A%200%3B%20vertical-align%3A%20middle%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EProxy%20for%20sub%20path%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3ESometimes%20you%20may%20notice%20the%20remote%20endpoint%20is%20using%20sub-path%20to%20get%20static%20files%20like%20pictures%20or%20JavaScript%20files.%20We%20can%20set%20proxy%20for%20them%20as%20well.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22KevinLi_2-1629358655727.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F304338iF445B16EC10663A6%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22KevinLi_2-1629358655727.png%22%20alt%3D%22KevinLi_2-1629358655727.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E5.%20Advanced%20mode%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EWe%20can%20also%26nbsp%3Bmanually%20edit%20proxies.json%20file%20and%20deploy%20it%20as%20part%20of%20our%20app%20when%20we%20use%20any%20of%20the%20deployment%20methods%20that%20Functions%20supports.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22KevinLi_12-1629296284985.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F304098i5ECADCB8BA2FB410%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22KevinLi_12-1629296284985.png%22%20alt%3D%22KevinLi_12-1629296284985.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E6.%20Disable%20local%20call%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EBy%20default%2C%20Functions%20proxies%20use%20a%20shortcut%20to%20send%20API%20calls%20from%20proxies%20directly%20to%20functions%20in%20the%20same%20function%20app.%20This%20shortcut%20is%20used%20instead%20of%20creating%20a%20new%20HTTP%20request.%20We%20can%20disable%20that%20shortcut%20behavior%20by%20setting%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-functions%2Ffunctions-app-settings%23azure_function_proxy_disable_local_call%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAZURE_FUNCTION_PROXY_DISABLE_LOCAL_CALL%3C%2FA%3E%20to%20true%20in%20application%20settings.%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E7.%20Decode%20slashes%20in%20backend%20URL%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EWhen%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-functions%2Ffunctions-app-settings%23azure_function_proxy_backend_url_decode_slashes%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAZURE_FUNCTION_PROXY_BACKEND_URL_DECODE_SLASHES%3C%2FA%3E%20is%20set%20to%20true%2C%20the%20URL%20example.com%2Fapi%252ftest%20resolves%20to%20example.com%2Fapi%2Ftest.%20By%20default%2C%20the%20URL%20remains%20unchanged%20as%20example.com%2Ftest%252fapi.%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E8.%20Introduction%20Video%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EBelow%20is%20our%20Azure%20Friday%20on%20Azure%20Function%20Proxies.%3C%2FP%3E%0A%3CP%3E%3CIFRAME%20src%3D%22https%3A%2F%2Fchannel9.msdn.com%2FShows%2FAzure-Friday%2FServerless-APIs-with-Azure-Function-Proxies%2Fplayer%22%20width%3D%22960%22%20height%3D%22540%22%20frameborder%3D%220%22%20allowfullscreen%3D%22allowfullscreen%22%20title%3D%22Serverless%20APIs%20with%20Azure%20Function%20Proxies%20-%20Microsoft%20Channel%209%20Video%22%3E%3C%2FIFRAME%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EThanks%20for%20reading%20this%20post.%20I%20hope%20you%20enjoyed%20it.%20Please%20feel%20free%20to%20write%20your%20comments%20and%20views%20about%20the%20same%20over%20here.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2614677%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2686107%22%20slang%3D%22en-US%22%3ERe%3A%20Play%20with%20Proxy%20in%20Azure%20Function%20App%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2686107%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Kevin%2C%20that%20is%20really%20handy.%3C%2FP%3E%3CP%3EI%20am%20now%20engaged%20in%20multiple%20tasks%20around%20the%20function%20proxy%2C%20and%20lately%2C%20our%20QA%20team%20noticed%20a%20bug%20related%20to%20how%20function%20proxy%20is%20dealing%20with%20cookies.%3C%2FP%3E%3CP%3Ewe%20noticed%20that%20the%20proxy%20merges%20multiple%20cookie%20headers%20into%20one%20(the%201st%20cookie%20).%20so%20not%20sure%20if%20we%20could%20sort%20this%20out%20somehow.%20we%20are%20using%20V3%20function%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2690559%22%20slang%3D%22en-US%22%3ERe%3A%20Play%20with%20Proxy%20in%20Azure%20Function%20App%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2690559%22%20slang%3D%22en-US%22%3E%3CP%3EA%20quick%20update%20on%20my%20last%20comment%20about%20the%20Cookies%20issue.%20we%20managed%20to%20fix%20that%20by%20downgrade%20the%20function%20runtime%20version%20to%20V%201%20instead%20of%20v3%2C%20and%20now%20we%20can%20see%20all%20the%20cookies%20as%20they%20should%20be%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22OmarRob_0-1630029582235.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F306136i03A6480774173F89%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22OmarRob_0-1630029582235.png%22%20alt%3D%22OmarRob_0-1630029582235.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2700880%22%20slang%3D%22en-US%22%3ERe%3A%20Play%20with%20Proxy%20in%20Azure%20Function%20App%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2700880%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1137788%22%20target%3D%22_blank%22%3E%40OmarRob%3C%2FA%3E%2C%26nbsp%3BI%20did%20not%20notice%20the%20change%20in%20their%20handling%20of%20cookies%20before.%20Thanks%20for%20sharing%20the%20update%20with%20me!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Co-Authors
Version history
Last update:
‎Aug 19 2021 12:39 AM
Updated by: