Target server configuration with www.

My backend url looks like http://www.test.com/apis/v1/users.

I configured the target server as www.test.com with port 80.

This is my proxy target endpoints looks like

<HTTPTargetConnection>
  <LoadBalancer>
    <Server name="TEST"/>
  </LoadBalancer>
  <Path>/apis/v1{proxy.pathsuffix}</Path>
</HTTPTargetConnection>

I am getting 503 with the message

{"fault":{"faultstring":"The Service is temporarily unavailable","detail":{"errorcode":"messaging.adaptors.http.flow.NoActiveTargets"}}}

This is happening as i have www. in the backend api url. I have many other apis without www. and those are working fine.

0 7 471
7 REPLIES 7

You don't need to mention www in target server. Just add target server as

test.com

Also make sure these are in same environment where api is deployed.

Doesn't work. I am getting 404 as url formed without www. like http://test.com/. Please note that if i hit the backend url without www. i am getting same 404.

In my case it works fine except showing me 302 response. but not receiving 404 response

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TargetEndpoint name="default">
    <Description/>
    <FaultRules/>
    <PreFlow name="PreFlow">
        <Request/>
        <Response/>
    </PreFlow>
    <PostFlow name="PostFlow">
        <Request/>
        <Response/>
    </PostFlow>
    <Flows/>
    <HTTPTargetConnection>
        <LoadBalancer>
            <Server name="test"/>
        </LoadBalancer>
        <Path>/contact</Path>
    </HTTPTargetConnection>
</TargetEndpoint>

HTTP/1.1 302 
Moved Temporarily
Date:Tue, 13 Mar 2018 01:25:26 GMT
Content-Length:161
Location:https://www.test.com/
X-DIS-Request-ID:06cc31155c6668474fd15367521ec581
Connection:keep-alive
Content-Type:text/html
Server:nginx/1.13.4

<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx/1.13.4</center>
</body>
</html>

Did you hit the url https://www.test.com/ directly without apigee? Are you getting 404 or 302 when you hit the url directly.

@Dino any thoughts on this.

Hi Krish,

sorry you're having trouble. I'm not clear on the problem .

I think you're saying

  1. if you configure an API Proxy in Apigee Edge, to connect with a target server configured to point to "http://test.com" , then the API Proxy returns a 404.
  2. AND ALSO if you try to use curl or other http client to directly connect to http://test.com you are similarly receiving a 404

If I understand the situation correctly, then your first observation is not surprising. Apigee Edge targets may treat a non-2xx status code as error. IF the target server returns 302, it could be that the Apigee Edge proxy treats that as a fault and returns a 404 to the client.

As for the second observation, I just tried to connect with http://test.com and received a 302 as Faij reported.

$ curl -i http://test.com 
HTTP/1.1 302 Moved Temporarily
Server: nginx/1.13.4
Date: Fri, 16 Mar 2018 16:56:13 GMT
Content-Type: text/html
Content-Length: 161
Connection: keep-alive
Keep-Alive: timeout=20
Location: https://www.test.com/
X-DIS-Request-ID: 4aadd704850663ec86242addf79eceb0


<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx/1.13.4</center>
</body>
</html>

I think that maybe I am not really understanding your situation or what problem we are trying to solve. Do you really want a target server to point to test.com ? If so, why?

I don't get it.

Sorry @Dino to confuse you. test.com is just an example.


I have a backend api url as http://www.safetarcapi.xxx.com/apis/v1/orders which works fine in postman. But without the www. i get 404 in postman. I am wondering how am I going to configure the target server for this api. If i create a target server "SAFETRAC" with host www.safetarcapi.xxx.com and 80 port, I am getting 503. If i don't use www. I am getting 404.

Does it make sense?