Closed vickydhas closed 7 years ago
I checked this and its working on the local machine IP but not on the AWS IP or ec2.aws...com address.
Double checked that the port 8088, 8089 are open and also the 80,8080 as well.
Previously these settings were working for the AWS IP added instead of localhost/10.211.55.9 , now it have stopped after the mongoose rel folder upgrade.
%% MongooseIM HTTP API it's important to start it on localhost %% or some private interface only (not accessible from the outside) %% At least start it on different port which will be hidden behind firewall
{ {8088, "10.211.55.9"} , ejabberd_cowboy, [ {num_acceptors, 10}, {max_connections, 1024}, {modules, [ {"10.211.55.9", "/api", mongoose_api_admin, []} ]} ]},
Can help me please to check this issue.
Hello Team,
Can you please guide over this as this is working only in local machine IP and now on the AWS hosted chat server. I have also tried reinstalling the AWS and configure the security groups for the ports required. this setup worked well in Old Beta 2.0.0 but not the official release.
Any guidance is much appreciated.
This API is not protected by any authentication at this moment. Because of that it's not safe to enable it on any publicly available interface. If you have f.e a dedicated interface to which only your other services can connect you can use this one. Try to find the IP address of the interface on the machine you run MongooseIM. Usually it's done by ifconfig
. Use the IP address for your interface f.e 10.152.1.12.
In the config file you just need to replace "127.0.0.1" with the chosen IP.
Hello Michal,
I have tried replacing this as mentioned earlier as well and just to inform this is working properly in the Local IP environment, but as soon as I replace the AWS instance private IP or host ec2.aws.....com address the API doesn't work.
Testing through the REST Chrome client that the response block shows the Cowboy server found but the "Response empty" error is always returned. Even tried this using the curl command but no success over that.
Appreciate if you can give guidance why this is happening in the official 2.0.0 release as this same setup to give the private AWS IP was working absolutely fine in the beta 2.0.0 version.
Thanks for your guidance in advance.
Are you sure your XMPP host (as set in the ejabberd.cfg) file is: ec2-111-222-333-444.ap-southeast-1.compute.amazonaws.com
?
Yes the xmpp host that i set in ejabberd cfg file the same IP ec2... was not working in beta as it required proper IP address due to DNS issue given as error in ejabberd logs.
Then the same settings stopped after the upgrade of 2.0.0 was done. The settings worked in for AWS hosted chat in previous beta version.
I have also tried the inbound settings changes, port opening, and reinstall chat server on another instance but same issue.
-- Sent from my iPhone6+
Is it possible for you to capture the TCP traffic between the client and server? I'd like to see what is exactly returned by MongooseIM.
how you want me to do that. I mean what exact way would be comfortable as its AWS instance so not much I can gather.
You have many options, here are 2 suggested by me:
curl
command with option -v
. This will enable verbosity, and paste here the whole command and the output.Following is the output I am getting after hitting the curl command.
`Note: Unnecessary use of -X or --request, GET is already inferred.
Trying 51.251.251.211...
Connected to ec2-51-251-251-211.ap-southeast-1.compute.amazonaws.com (51.251.251.211) port 8088 (#0)
GET /api/users/ec2-51-251-251-211.ap-southeast-1.compute.amazonaws.com HTTP/1.1
Host: ec2-51-251-251-211.ap-southeast-1.compute.amazonaws.com:8088
User-Agent: curl/7.49.1
Accept: application/json
< HTTP/1.1 404 Not Found
< server: Cowboy
< date: Mon, 12 Dec 2016 14:22:51 GMT
< content-length: 0
<
Dev-MacBook-Pro:~ developer$`
I have changed the IP address for confidentiality purpose rest all details are exact as given by curl output.
From this output I can see that:
ec2-51-251-251-211.ap-southeast-1.compute.amazonaws.com
doesn't match what's in the ejabberd.cfg file.Could you please share with us your ejabberd.cfg file?
Okay as I see the same setup working fine earlier on beta means the second option for mismatch host name may not be issue. As IP like 172.x.x.x worked when placed in cowboy location and host name as ec2.252.c.aws.com.
Since ec2 address was not working when put same at cowboy location where 8088 port is mentioned.
Now left with modules not enabled how can we trace to help get the issue. Which all modules are required for this. Do you want me to deploy old beta rel abc figure out to give more info. -- Sent from my iPhone6+
Did you have a chance to read carefully this part of the doc: http://mongooseim.readthedocs.io/en/2.0.0/http-api/http-administration-api-documentation/? Required modules are described there.
Yes we followed these docs and also all this setup of commands was fine the get users call and post to add new users call was also checked.
In our earlier dscussion where you mentioned us to use usersname instead of user to make API was tested and working.
It's just stopped after new upgrade. -- Sent from my iPhone6+
Are you sure the module names you have right now in ejabberd.cfg are exactly the same as described in the docs? I remember they changed between beta and final release.
There is one more thing worth checking in your ejabberd.cfg file:
In the original config there is:
{modules, [
{"localhost", "/api", mongoose_api_admin, []}
]}
Did you change localhost
to your AWS domain? Alternatively you can change it to _
so that works with any host.
{modules, [
{"_", "/api", mongoose_api_admin, []}
]}
Attached my ejabberd cfg file with IP address modified for security.
....ejabberd file shared....
Thanks! Modules looks correct. What's wrong it the HTTP host. Please change this:
{"171.31.11.111", "/api", mongoose_api_admin, []}
to f.e
{"_", "/api", mongoose_api_admin, []}
Hello Michal,
Whats F.e ??? But great thanks this setup worked and i can get the users and commands working.
{ {8088, "171.31.11.111"} , ejabberd_cowboy, [ {num_acceptors, 10}, {maxconnections, 1024}, {modules, [ {"", "/api", mongoose_api_admin, []} ]} ]},
The "_" that you mentioned if I place an IP there will have issues.
I am glad you helped :) -- Sent from my iPhone6+
F.e stands for "For example"
If you had an IP instead of _
you would need to send your HTTP request to the IP and not to the host and the other way around. _
is an wildcard meaning that the HTTP host is irrelevant and the request will be processed anyway.
Thanks for info sharing. Great help man :) -- Sent from my iPhone6+
MongooseIM version: 2.0.0 Installed from: GitHub Erlang/OTP version: 18
Describe the issue.
https://github.com/esl/MongooseIM/issues/1055
GET Request send with this URL. Request : http://ec2-111-222-333-444.ap-southeast-1.compute.amazonaws.com:8088/api/users/ec2-111-222-333-444.ap-southeast-1.compute.amazonaws.com