I'm creating an iOS app that uses a Rails API backend on Heroku. Periodically (one every 20 API calls), heroku cannot be found. The following NSError is returned:
Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo=0x755ce00 {NSErrorFailingURLStringKey=https://xxx.herokuapp.com/api/v1/matchups, NSErrorFailingURLKey=https://xxx.herokuapp.com/api/v1/matchups, NSLocalizedDescription=A server with the specified hostname could not be found., NSUnderlyingError=0x71ca730 "A server with the specified hostname could not be found."
Seems like a DNS issue on the network to which your iPhone/iPad is connected. To be sure, try any of the following:
1) Change your host name to an IP address instead of a string hostname, and add a Host: header to the HTTP request.
2) If (1) is hard, set your iPhone's DNS to a PC on your LAN, and install a DNS server on that PC, and serve at least that specific address directly from the PC (don't recurse for that domain).
It looks like you are being hit by a Dyno sleep behaviour. Please check this documentation, specially the section Dyno sleeping and make sure you understand it.
Also there are several ways to keep the app on, like pinging the site regularly.
Another option is DNS, create an Ad-Hoc network on your computer and connect your iphone to that network. Use wireshark to make a network capture and analyse the DNS and HTTP responses.
Your url = https://xxx.herokuapp.com/api/v1/matchups
Did you explicitly specify your subdomain xxx with your domain provider to direct to your server IP?
If not, try add a new A record with your subdomain xxx point to your server IP.
Hope that helps.
Related
I'm trying to set up a simple email server for testing during development, but SSMTP keeps giving me "Invalid response SMTP server" even with -vvvv, I get no more information.
My ssmtp config file looks like this right now:
root=my-email#gmail.com
mailhub=smtp.sparkpostmail.com:587
rewriteDomain=email.codyhaines.com
fromLineOverride=yes
useSTARTTLS=yes
useTLS=yes
AuthMethod=AUTH LOGIN
AuthUser=SMTP_Injection
AuthPass=MY_SPARK_POST_API_KEY
I've set up the domain through sparkpost, and verified it with the TXT DNS record, my API_KEY has 'Send via SMTP' enabled. Not sure what's wrong with the config and why it's not sending.
My issue was with the network I was on. It seems the "Invalid response SMTP server" error is almost always a result of either connecting to a bad address or firewall issues (either on your local device, or your network). In my case, I was using a local coffee shop's wifi, and they blocked all non-standard ports, so it wasn't connecting.
I am using a remote PostgreSQL on another server and want to deploy Rails app to AWS. I want the AWS to communicate with that remote PostgreSQL database server.
I'm getting the error:
FATAL: Peer authentication failed for user "postgres"
Although I've whitelisted the IP in pg_hba.conf
How I've whitelisted?
I've seen the Public IP in AWS Console and added that. I've pinged my AWS site and added that IP.
Peer authentication in the error means you're not trying to connect remotely, but locally. You must review the settings in database.yml. See
PG Peer authentication failed for a related question.
Once you're ready to connect to the real remote server, that'll probably still won't work with the pg_hba.conf linked to in the comments because of:
host all all * md5
host all all [AWS-PINGED-IP] md5
host all all [AWS-SPECIFIED-PUBLIC-IP] md5
* is not accepted as an IP address mask, shell wildcards syntax is not welcome here. Use 0.0.0.0/0 in CIDR notation to mean "any IPv4 address".
Or remove entirely this line if you didn't mean to accept connections from any address, which seems to be the case given the two lines after.
Note that rules interpretation stops at the first match in order of declaration, so it doesn't make sense to have an "accept-all" rule followed by a much more restrictive rule, as the latter will always be ignored.
I believe the way to creating a remote connection is by changing this line in conf/neo4j-server.properties, specifically by removing the comment and restarting the server.
org.neo4j.server.webserver.address=0.0.0.0
My URL is https://0.0.0.0:7473/browser/ and works on the local machine, but when I test the URL in Safari on iPhone over 3G, it cannot connect.
What do I set the address to in the properties file?
I thought it was the IP address of my computer, but after trying the remote address which I got from Googling “ip address mac” that didn’t work, nor did (obviously) the local IP address of my machine, 192.168.0.14
I should point out that setting it to the IP address from Google throws an error and the log reads:
2015-01-29 17:10:08.888+0000 INFO [API] Failed to start Neo Server on port [7474], reason [MultiException[java.net.BindException: Can't assign requested address, java.net.BindException: Can't assign requested address]]
With default configuration Neo4j only accepts local connections
In neo4j-community-3.1.0 edit conf/neo4j.conf file and uncomment the following to accept non-local connections
dbms.connectors.default_listen_address=0.0.0.0
By setting
org.neo4j.server.webserver.address=0.0.0.0
enables Neo4j on all network interfaces.
The remainder of that reply is not Neo4j related at all - it's regular networking. Double check if port 7473 (and/or 7474) are not blocked neither be a locally running firewall nor by your router. You local IP 192.168.0.14 indicates you're behind a router doing NAT. Therefore you have to setup a port forwarding in your router for the ports mentioned above.
Please be aware that this is potentially dangerous since everyone knowing your external IP can access your Neo4j instance. Consider using either https://github.com/neo4j-contrib/authentication-extension or use a VPN in favour of port forwarding.
in 3.0:
##### To have HTTP accept non-local connections, uncomment this line
dbms.connector.http.address=0.0.0.0:7474
Confused myself with the setting. Anyone who has the same problem, 0.0.0.0 just means “this server isn’t local any more” and so to access it you use the public IP address of the computer that’s hosting the Neo4j server.
Just make sure that the ports you set in the server properties (default are 7474 and 7473) are open for incoming connections on your router/firewall etc.
I think there's some confusion here. That configuration property org.neo4j.server.webserver.address is about which IP address the server you're starting listens on for external connections. Relevant documentation is here.
It seems you're asking how to configure your database to talk to a remote database. I don't think you can do that. Rather, by editing that file you're planning on running a database on the host where that file is. Your local database on that host will write files to wherever the org.neo4j.server.database.location configuration parameter points.
A remote connection is something that the neo4j shell might establish, or that you browser might make to a foreign server running neo4j; but you don't establish that sort of remote connection by editing that file. Hopefully this helps.
Also if you have ssh access to remote server with neo4j you can setup ssh tunnel to access it via localhost:
ssh -NfL localhost:7474:localhost:7474 -L localhost:7687:localhost:7687 yourname#yourhost
then type in browser:
localhost:7474
Depends on the version.
Look for the phrase 'non-local connections' in the conf file.(In my case, $NEO4J_HOME/conf/neo4j.conf)
Then follow the instructions in the comments.
In my case,
# With default configuration Neo4j only accepts local connections.
# To accept non-local connections, uncomment this line:
server.default_listen_address=0.0.0.0
I am trying to get client ip in Rails 3.
Application is installed in cloud hosting, with SSL, and nginx server.
I wrote some code to get client ip.
request.remote_ip
request.env['HTTP_X_FORWARDED_FOR']
But it returns wrong address, like '10.159.21.86'
Is there any issue related Nginx server, or SSL installation?
def remote_ip
#remote_ip ||= (#env["action_dispatch.remote_ip"] || ip).to_s
end
request.remote_ip gets the ip address of the client outside of local proxies but If your request is coming from your development machine and the development machine is where your server is, probably you will get 127.0.0.1 or wrong ip But if the request is coming from another machine, this will be the IP the remote machine. However, under various conditions this may not be the real IP of the machine (machine behind proxy, using tor or other tool to hide it e.t.c.). so you can also try:-
request.env['REMOTE_ADDR']
You should visit this post written by rails contributor describing Repeated headers and Ruby web servers
I believe the issue you have is the same described in the following Engine Yard support request: HAProxy, SSL Requests & Request IP Addresses.
Apparently there is a workaround, but you are supposed to contact them directly to know what it is.
The docs team is working on formal documentation, for the short term, please open a ticket and a support engineer can help out.
If you're using SSL with HAProxy (the default configuration for multi-instance environments) then it will not be able to pull the remote IP due to the hand-off from HAProxy to Nginx. We have a solution that uses stunnel to get around this but since all SSL decryption is done on the App Master instance, if you have more than about five instances then performance will suffer.
The other option is to use Elastic Load Balancer instead of HAProxy. The documentation for that is at https://support.cloud.engineyard.com/entries/21715452-Use-Elastic-Load-Balancing-with-Engine-Yard-Cloud.
Evan
I'm trying to retrieve emails from gmail using pop3 to my rails applicaiton. I get the error - "getaddrinfo: Temporary failure in name resolution" when i try to retrieve the email.
the weird thing is, it works when i try it at home but not at my university. i'm guessing it has something to do with the internet connection.
please help!
I had the same problem just started getting this error out of the blue in a RoR application that connects to an API using a RestClient running on a local virtual machine using Vagrant that I have as a development environment.
The only thing that fixed the issue was simply restarting my virtual machine. Just done a vagrant down & up command, then rackup and back in the game.
This generally means you aren't getting a response from DNS. Your university connection is probably behind a proxy preventing you from directly accessing the Internet. If so, this proxy must be specified in your code. Check your POP3 library documentation, or failing that, you may be able to use a library like socksify that redirects TCP connections through your SOCKS proxy.
Simple. You may be directed through a proxy server. Set up a new connection ,set up your college settings,restart your server and it should work.
ssh into your server and check if the machine is able to resolve the domain.
ping <your_site> should resolve the domain name to IP.
If its not resolving correctly, then there is some problem in your hosting service.
quick fix: You can manually map domain-to-ip in the etc/hosts file of your server.