I am following along with this Treehouse Build a Rails API course. I am using Cloud9 IDE which I think is related to the problem. The step I am stuck on is creating a new list via the API in the console.
At first I was receiving an error message saying "cannot render console" from the network. After googling this, I whitelisted the network in the development.rb file. The error message is different and so I believe I properly whitelisted it (or at least did something). But it does not have the desired effect and the error message seems to contradict itself.
Started POST "/api/lists" for 123.456.78.999 at 2015-09-14 14:53:33 +0000 Cannot render console from 123.456.78.999! Allowed networks: 123.456.78.999, 127.0.0.0/127.123.123.123, ::1
I've changed the numbers because I am not savvy about security. The point (and to me, the mystery) is that it says I can't render the console from a network that is apparently allowed (i.e., 123.456.78.999 === 123.456.78.999).
I would appreciate any advice on what could be the problem. I had no trouble following along with the tutorial until this step; the commands I entered led to the same result as in the videos.
This is the most recent command I've entered:
curl -i -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"title":"The Title will go here"}' https://myapp-me.c9.io/api/lists
Entering that URL instead of "localhost" has worked for me thus far but it could also be related to the problem.
Thank you for any clues and happy to post additional code if needed.
please add in config/enviroments/development.rb
config.web_console.whitelisted_ips = '0.0.0.0/0.0.0.0'
To whitelists 2 IPs > Consider this example:
config.web_console.whitelisted_ips = %w( 127.0.0.1 10.0.0.9 )
To whitelist an entire IP subnet > Consider this example:
config.web_console.whitelisted_ips = %w( 127.0.0.1 10.0.0.0/24 )
always add 127.0.0.1, or else the local machine won't have access.
If anyone is still viewing this question in 2022 like I am, then you can edit config/environments/development.rb to account for the entire private network like so:
Rails.application.configure do
.
.
.
config.web_console.permissions = '123.456.78.0/16'
end
More information here.
Part of the problem is that you need to be within the "sudo su" shell in order to run Ruby on Rails applications. So, make sure that you run sudo su and you become root. The second problem is that you MUST run your application on port 8080 so when you run the server make sure the -p 8080 flag is set:
bundle update (optional)
bundle install (optional)
sudo su
rails s -p 8080
New terminal --> Preview --> Preview running application
Related
If you deploy using the command below,
twilio flex:plugins:deploy --changelog='first deploy'
The following error will occur.
I don't understand the meaning of the path pointed to by resource.
Error code 20404 from Twilio: The requested resource /Services/ZSXXXXXXXXXXXXXXXXXXXXXXX/Environments was not found. See https://www.twilio.com/docs/errors/20404 for more info.
This is the first deployment that has not been deployed yet.
What should i do?
twilio serverless:deploy
Using the above command, functions and assets are deployed on a serverless basis.
At that time, I have deleted the Services of functions and assets that existed by default.
Is this default Services relevant for plugins?
Also, if it is related, where is the part to reset in the plug-in?
When I contacted support, they told me to run the reset command.
curl https://flex-api.twilio.com/v1/Configuration \
-H "Content-Type: application/json" \
-d '{"account_sid":"ACCOUNT_SID", "serverless_service_sids": []}' \
-u ACCOUNT_SID:AUTH_TOKEN
If you deploy again after executing the above command
I was able to deploy without problems.
I have my rails in a server A and I created a separate server where Go-lang is installed
My Goal is to use Anycable-Go with Rails but being in separated server.
I can't really find any clear explanation in google how to do that, but from the doc I tried the following in my "Go" server :
go get -u -f github.com/anycable/anycable-go/cmd/anycable-go
then
anycable-go --rpc_host=0.0.0.0:50051 --headers=cookie,x-api-token \
--redis_url=redis://{my_redis_username}:{my_redis_password}#{my_redis_machine_url} --redis_channel=anycable \
--host=0.0.0.0 --port=8084
The output looks like this :
Am really not that sure am on the right track so far... but if so, how am supposed to make my rails app connect/using this "anycable-go" server ?
You need to add anycable-rails gem to your app and run AnyCable RPC server (bundle exec anycable) along with the Rails server. See https://docs.anycable.io/#/using_with_rails
I have a rails application that I set to use a proxy so that I could update gems in my school's LAN.
However now that I'm not using the school's network, when I do
bundle install
I get this error
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/home/me/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/uri/generic.rb:214:in `initialize': the scheme http does not accept registry part: cavs#students:cavsuon#proxy.uonbi.ac.ke:80 (or bad hostname?) (URI::InvalidURIError)
When I also do
gem update bundler
or
gem update --system
I get this error
ERROR: While executing gem ... (URI::InvalidURIError)
the scheme https does not accept registry part: cavs#students:cavsuon#proxy.uonbi.ac.ke:80 (or bad hostname?
I cannot recall how I set up my app to use proxy but even when I did it has never worked so I thought that it was never using a proxy in the first place.
How can I unset this proxy configuration and set it again if I'm on my school's network
Upon doing
echo $http_proxy
as suggested, I get
http://cavs#students:cavsuon#proxy.uonbi.ac.ke:80
How do I unset $http_proxy
By default it may be picking up the http_proxy environment variable.
Try running
echo $http_proxy
on the command line to see what it gives back to you. You can set that value using
export http_proxy=http://user:password#host:port
If that doesn't work, also see what HTTP_PROXY is set to.
You can unset a variable temporarily by using unset http_proxy. If it is something you need to change more permanently (i.e. it is there every time you open a terminal) you will need to check the various hidden files in your home directory (i.e. .profile or .bashrc) to find and remove it.
I had similar problem which turned out to be the problem in Ruby itself:
The problem is related to the uri component of Ruby itself, which
tries to match the userinfo part of the URI
So, in your case, according to this regexp doesn't accept # character and you should modify your /usr/lib/ruby/1.8/uri/common.rb:
-ret[:USERINFO] = userinfo = "(?:[#{unreserved};:&=+$,]|#{escaped})*"
+ret[:USERINFO] = userinfo = "(?:[#{unreserved};:&=+$,#]|#{escaped})*"
run export http_proxy=http://x.x.x.x:8080 on the command line and then check if that has changed using echo $http_proxy. This worked for me on 12/18/2018
I have a grails app that moved to a new subnet with a change to the DNS. As a result, the logout functionality stopped working. When I inspect the network using chrome, I get this message under request headers: CAUTION: Provisional headers are shown.
This means request to retrieve that resource was never made, so the headers being shown are not the real thing.
The logout function is executing this action
package edu.example.performanceevaluations
import org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils
class LogoutController {
def index = {
// Put any pre-logout code here
redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl // '/j_spring_security_logout'
}
}
Would greatly appreciate a direction to look towards.
As suggested by that link run chrome://net-internals and see if you get anywhere
If you are still lost, I would suggest a two way debugging if you have Linux find something related to your traffic and run either something like tcpdump or if thats too complex install and run ngrep -W byline -d any port 8080 -q. and look for the pattern see what is going on.
ngrep/tcpdump and look for that old ip or subnet on entire traffic see if anything is still trying get through - (this all be best on grails app server ofcourse
(unsure possibly port 8080 or any other clear text port that your app may be running on)
Look for your ip in the apache logs does it hit the actual server when you log out etc?
Has the application been restarted since subnet change since it could have cached the next point from application in the running Java process:
pgrep java|awk '{print "netstat -plant "$1" |grep "$1 }'|/bin/sh
or
pgrep java|awk '{print " lsof -p "$1" |grep -i listen"}'|/bin/sh
I personally think something somewhere needs to be restarted since its hooking on to a cache of something .
Also check the hosts files of any end machines involved ensure nothing has previous subnet physically configured in there.
I get the error below when trying to start my rails app on the localhost:
PGError (could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
From what I have read it sounds like this is most likely a problem in connecting to the Postgres server, and may indicate that it is not started?
It all started when I was attempting my first (yay noobs!) merge using git. There was a conflict (having to do with the Rubymine workspace.xml file), and I started to open up a conflict resolution program. It then seemed that there was really no need to track workspace.xml at all and so I quit from the resolution program, intending to run "git rm --cached" on the file. I think in quitting the program something went foul, and I ended up restarting, before untracking the file, and then completing the merge. Further evidence that something was gummed up is that my terminal shell didn't open up correctly until I restarted the machine.
Now, as far as I can tell, everything in the merge went fine (there were trivial differences in the two branches anyway), but for the life of me I can't seem to get rid of this PGError. If it is as simple as starting the server, then I'd love help on how to do that.
(other context: OSx, rails 3, posgresql83 installed via macports, pg gem).
EDIT - I have been trying to start up the server, but am not succeeding. e.g., I tried:
pg_ctl start -D /opt/local/var/db/postgresql83/defaultdb
This seems to be the right path for the data (it finds the postgresql.conf file) but the response I get is "cannot execute binary file."
Try sudo port load postgresql83-server - this should work with the latest 8.3 port from macports.
If this doesn't work, try sudo port selfupdate; sudo port upgrade outdated and then try again.
Note - this may take absolutely ages.
and may indicate that it is not started?
Yes, sounds like the server is not running on your local machine.
See the description of this error in the PostgreSQL manual:
http://www.postgresql.org/docs/8.3/static/server-start.html#CLIENT-CONNECTION-PROBLEMS
To start the server, try something along the following lines (adjust for pgsql version # and logfile):
sudo su postgres -c '/opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/db/postgresql8/defaultdb -l /opt/local/var/log/postgresql84/postgres.log start'
To stop the server,
sudo su postgres -c '/opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/db/postgresql84/defaultdb stop'