Unable to identify proxy for host...

Not applicable

Hello! I'm hoping that this isn't a daft question but I'm getting the following error upon a curl POST request:

{
    "fault": {
        "detail": {
            "errorcode": "messaging.adaptors.http.configuration.ApplicationNotFound"
        },
        "faultstring": "Unable to identify proxy for host: <org>-<env>-sandbox.apigee.net:12872 and url: /aty/oauth/client_credential/accesstoken"
    }
}

Now I'm essentially following the oauth guide and hit a road block.

With the OOTB oauth proxy I would have thought that the following cUrl should:

curl -v -X POST "https://<org>-<env>-sandbox.apigee.net/aty/oauth/client_credential/accesstoken" -d 'grant_type=client_credentials' -d "client_id=${consumer_key}&client_secret=${consumer_secret}"

NOTE: I have stripped the org and environment out but these have been checked and are correct.

It seems that this has been asked before however short of undeploying and redeploying I couldn't see any other solutions.

To check that this wasn't due to the HTTPS protocol for some reason I modified HTTPProxyConnection to the following:

Note: adding default none HTTPS virutual hosts

    <HTTPProxyConnection>
        <BasePath>/aty/oauth/client_credential</BasePath>
        <Properties/>
        <VirtualHost>default</VirtualHost>
        <VirtualHost>secure</VirtualHost>
    </HTTPProxyConnection>

But I still have the same issue, so reverted that.

This is the Proxy Endpoints configuration:

Note: that I have modified the endpoint slightly.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxyEndpoint name="default">
    <Description/>
    <FaultRules/>
    <Flows>
        <Flow name="RefreshAccessToken">
            <Description/>
            <Request>
                <Step>
                    <FaultRules/>
                    <Name>RefreshAccessToken</Name>
                </Step>
            </Request>
            <Response/>
            <Condition>(proxy.pathsuffix MatchesPath "/refresh_accesstoken") and (request.verb = "POST")</Condition>
        </Flow>
        <Flow name="AccessTokenClientCredential">
            <Description/>
            <Request>
                <Step>
                    <FaultRules/>
                    <Name>GenerateAccessTokenClient</Name>
                </Step>
            </Request>
            <Response/>
            <Condition>(proxy.pathsuffix MatchesPath "/accesstoken") and (request.verb = "POST")</Condition>
        </Flow>
    </Flows>
    <HTTPProxyConnection>
        <BasePath>/aty/oauth/client_credential</BasePath>
        <Properties/>
        <!--<VirtualHost>default</VirtualHost>-->
        <VirtualHost>secure</VirtualHost>
    </HTTPProxyConnection>
    <RouteRule name="NoRoute"/>
</ProxyEndpoint>

This is the GenerateAccessTokenClient:

Unmodified

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OAuthV2 name="GenerateAccessTokenClient">
    <!-- This policy generates an OAuth 2.0 access token using the client_credentials grant type -->
    <Operation>GenerateAccessToken</Operation>
    <!-- This is in millseconds, so expire in an hour -->
    <ExpiresIn>3600000</ExpiresIn>
    <SupportedGrantTypes>
        <!-- This part is very important: most real OAuth 2.0 apps will want to use other
         grant types. In this case it is important to NOT include the "client_credentials"
         type because it allows a client to get access to a token with no user authentication -->
        <GrantType>client_credentials</GrantType>
    </SupportedGrantTypes>
    <GrantType>request.queryparam.grant_type</GrantType>
    <GenerateResponse/>
</OAuthV2>

Any advice would be grand!

0 18 16.7K
18 REPLIES 18

Hi @alex.tylor,

I'm not sure if this is causing the error, but in the GenerateAccessTokenClient policy, I see that <GrantType> is set so that Edge will look for the "grant_type" in a query parameter, however, you're passing it in the body. Try removing this line:

<GrantType>request.queryparam.grant_type</GrantType>

Then, save and try calling the API again.

You also need to pass in the client_secret and client_id either as body parameters (as shown in the tutorial) or as a base64-encoded basic authorization header. I assume you're doing the latter.

Let me know if you get it working, or I'd be happy to do more troubleshooting with you.

Will

Hi @wwitman,

Unfortuantley that didn't work. But you are right that I am passing in the client key and secret! I'll edit the question to reflect that.

adas
New Member

@alex.tylor This error usually means the message processors are not able to classify the request - classification error. This can happen due to one of the following:

- the proxy is not deployed to the environment that you are hitting

- the request host header doesn't match the hostAlias for the environment on which the proxy is deployed

For example, if your proxy as a basepath of /api/test and the proxy is deployed to env = test, your request should be:

curl -v http://myorg-test.apigee.net/api/test

where myorg-test.apigee.net is the hostAlias set in the virtualhost for the test environment and the proxy is deployed to that virtualhost.

Hi @arghya das

I've double checked that both the organisation and environment are indeed correct, and I'm hitting the desired environment.

adas
New Member

@alex.tylor Can you email me your org, env details with the sample curl call for your proxy.

Hi @arghya das I've dropped you an email. Thanks.

@alex.tylor I sent you an email with the details. I made some changes to your proxy and redeployed it. Works fine now.

I made some recommendations for you. You might need to work with Apigee support to resolve some of them like virtualhost configurations, ELB routing rules etc. Please let me know if it helps. If you have follow up questions, shoot me an email.

@alex.tylor & @arghya das can one of you post back a sanitized description of what might be a resolution to this issue? Thanks! can

Hi, I have to admin I can't remember the resolution and checking emails it's not stated. I believe this was due to two reasons. Firstly I was using a custom vhost which was not configured correctly, the second issue was the Apigee's Message Processor which needed to be restarted by a support call.

Not applicable

@alex.tylor or @arghya das Can you please forward the resolution to my email. Thanks

,

@alex.tylor & @arghya das Can you please email the resolution for the above. Thanks

I have followed the tutorials for getting access token from OAuth endpoint but I am getting the same error discussing above.

Here is my output and please help me to understand what exactly this means Unable to identify proxy for host: secure and url:.
Ravindra-Singh% curl -v -X POST "https://itravindrasingh-eval-test.apigee.net/oauth/client_credential/accesstoken" -d 'grant_type=client_credentials' -d "client_id=7UcE2ecuSkN8h8zmfJXq6nDVniMPxw07&client_secret=QUjWAClHHfxRd3Jb"
*   Trying 104.154.156.196...
* Connected to itravindrasingh-eval-test.apigee.net (104.154.156.196) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: *.apigee.net
* Server certificate: Go Daddy Secure Certificate Authority - G2
* Server certificate: Go Daddy Root Certificate Authority - G2
> POST /oauth/client_credential/accesstoken HTTP/1.1
> Host: itravindrasingh-eval-test.apigee.net
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Length: 103
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 103 out of 103 bytes
< HTTP/1.1 404 Not Found
< Date: Mon, 19 Feb 2018 10:57:21 GMT
< Content-Type: application/json
< Content-Length: 192
< Connection: keep-alive
< 
* Connection #0 to host itravindrasingh-eval-test.apigee.net left intact
{"fault":{"faultstring":"Unable to identify proxy for host: secure and url: \/oauth\/client_credential\/accesstoken","detail":{"errorcode":"messaging.adaptors.http.flow.ApplicationNotFound"}}}% 


@ravindrasingh

You had not deployed your API Proxy "oauth" in the test environment, so you were getting the error "Unable to identify proxy for host: secure and url: \/oauth\/client_credential\/accesstoken"

After deploying your API Proxy "oauth" in test environment, the API calls are going through successfully.

6477-screen-shot-2018-02-20-at-82505-am.png

From the screenshot, it seems my proxy is already deployed. isn't it? Please guide me how to deploy then.

Now it seems fixed, I have undeployed then deployed the proxy 'oauth' again from the proxy detail window and it has returned the output. Thanks a lot for your guidance @AMAR DEVEGOWDA

@ravindrasingh,

Glad that it helped you to resolve the issue.

Could you please accept the answer so that it will be helpful to others as well ?

@alex.tylor ....pls can you help me out too...am stuck trying to test my proxi API with my postman

You should create a new community post detailing how you're trying to test your proxy, details of your proxy and the error you're seeing.

@alex.tylor could you help me with your email?