none
API Management and Traffic Manager : 503 Service Unavailable

    Question

  • Hello,

    I want to configure a traffic manager in front of Azure API Management.

    In relation to the APIM, the product is published, its API has a mocked operation, it doesn’t require a subscription and the pricing tier is Developer. When calling the mocked API it works fine.

    In relation to the Traffic Manager, an external endpoint has been established pointing to the APIM’s Gateway URL, the status is ‘enabled’ and the monitor status shows ‘online’.

    However, every time I hit the traffic manager endpoint, I get a 503 Service Unavailable.

    I need to understand the correct way to accomplish this.

    Thanks



    Tuesday, January 9, 2018 1:05 PM

Answers

  • The APIM will only respond on hostnames registered on it, these could be custom hostnames.

    so, if you call APIM with something like

    mytrafficmanger.trafficmanager.net, then it will not work, as mytrafficmanager.trafficmanager.net is not registered in APIM.

    What you can do is 

    1. Create a self-signed cert issued to say *.myapim.net

    2. Configure Custom Domain in APIM to say endpoint apigateway.myapim.net using the certificate from Step 1.

    3. Go to your machines hosts file c:\Windows\System32\drivers\etc\host and assuming that your traffic manager IP address is 56.31.245.65, create hosts file entry

    56.31.245.65 apigateway.myapim.net

    4. Now when you make, say a GET HTTP request to apigateway.myapim.net/echo, <g class="gr_ gr_2026 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="2026" id="2026">request</g> will hit traffic manager, which will forward to APIM backend. APIM will see a host entry on which it is listening on and respond with 200 OK.

    Note: multiple APIM services can be registered with the Custom <g class="gr_ gr_2369 gr-alert gr_spell gr_inline_cards gr_disable_anim_appear ContextualSpelling ins-del" data-gr-id="2369" id="2369">Host name</g> (apigateway.myapim.net)

    • Proposed as answer by Swikruti Bose Wednesday, January 10, 2018 4:46 AM
    • Marked as answer by Jesus Ibanez Thursday, January 11, 2018 8:28 PM
    Wednesday, January 10, 2018 3:14 AM

All replies

  • The APIM will only respond on hostnames registered on it, these could be custom hostnames.

    so, if you call APIM with something like

    mytrafficmanger.trafficmanager.net, then it will not work, as mytrafficmanager.trafficmanager.net is not registered in APIM.

    What you can do is 

    1. Create a self-signed cert issued to say *.myapim.net

    2. Configure Custom Domain in APIM to say endpoint apigateway.myapim.net using the certificate from Step 1.

    3. Go to your machines hosts file c:\Windows\System32\drivers\etc\host and assuming that your traffic manager IP address is 56.31.245.65, create hosts file entry

    56.31.245.65 apigateway.myapim.net

    4. Now when you make, say a GET HTTP request to apigateway.myapim.net/echo, <g class="gr_ gr_2026 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="2026" id="2026">request</g> will hit traffic manager, which will forward to APIM backend. APIM will see a host entry on which it is listening on and respond with 200 OK.

    Note: multiple APIM services can be registered with the Custom <g class="gr_ gr_2369 gr-alert gr_spell gr_inline_cards gr_disable_anim_appear ContextualSpelling ins-del" data-gr-id="2369" id="2369">Host name</g> (apigateway.myapim.net)

    • Proposed as answer by Swikruti Bose Wednesday, January 10, 2018 4:46 AM
    • Marked as answer by Jesus Ibanez Thursday, January 11, 2018 8:28 PM
    Wednesday, January 10, 2018 3:14 AM
  • Thanks for your answer Samir, I now understand why the scenario was failing. However I still have these doubts:

    - from where should I take the Traffic Manager IP? (it is supposed to work at DNS level)

    - when you say "multiple APIM services can be registered with the Custom Host name" the only way to accomplish it is by having a Premium Tier?


    • Edited by Jesus Ibanez Wednesday, January 10, 2018 9:22 PM
    Wednesday, January 10, 2018 9:22 PM
  • - yes, my bad on the Traffic Manager IP. You would need to create a CNAME entry to TrafficManager domain
    apigateway.myapim.net IN CNAME mytrafficmanager.trafficmanager.net 

    - No Premium is not needed, you can have apigateway1(Basic SKU), apigateway2(Developer SKU) and apigateway3 (Standard SKU) APIM services and configure each one of them with the same Custom Domain apigateway.myapim.net 

    Thursday, January 11, 2018 3:41 PM