How do I achieve local proxy chaining using httpClient in Javascript?

jaupadhyay
Participant IV

Hi

I am trying to do local proxy chaining using httpClient in Javascript.

where I am using url which looks like http://localhost:8998/targetproxybasepath to call another local proxy. Call is failing as I believe localhost is not supported with httpClient?

Is there any way to do local proxy chaining using httpClient.send or httpClient.get?

Thanks & Regards

Jayesh

Solved Solved
0 9 759
1 ACCEPTED SOLUTION

jaupadhyay
Participant IV

Hi @Dino-at-Google

Thank you for your suggestion. I tried with 127.0.0.1 but unfortunately It didn't work. I found the work around. Since we are using Private cloud version, I am calling message processor server directly on 8998 port so url is http://apigeemsgprocessserer:8998/targetproxybasepath with additional header called X-Apigee.Host where I pass the value of my virtualhost and that seems to work fine.

View solution in original post

9 REPLIES 9

I dunno. Maybe try 127.0.0.1 ?

jaupadhyay
Participant IV

Hi @Dino-at-Google

Thank you for your suggestion. I tried with 127.0.0.1 but unfortunately It didn't work. I found the work around. Since we are using Private cloud version, I am calling message processor server directly on 8998 port so url is http://apigeemsgprocessserer:8998/targetproxybasepath with additional header called X-Apigee.Host where I pass the value of my virtualhost and that seems to work fine.

Excellent! Glad you found the solution.

I am also having the same problem but in my case I am using public cloud. I tried using https://localhost:8998/basepath and https://127.0.0.1/basepath but these doesn't work and show error host not reachable.

Out of curiosity, Is there a particular reason you're trying to do this with javascript rather than just using a service callout?

@dane knezic I am trying to call target proxy multiple times for each element of array from original incoming request. That's why Service call out option was ruled out.

Not applicable

local chaining hits directly to the message processor with port 8998 and the host as localhost. You can configure the same to your javascript.

Can you share your piece of javascript code because I tried the same and it seems to not work.

Do you get the solution?