0

I'm using Rails 5.2.1 and ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]

When I starts rails server and connect via internet as below, I getting an error. Please Let me know what I need to do fix that.

enter image description here

Started GET "/" for 183.91.0.68 at 2018-11-15 14:17:28 +0700 Cannot render console from 183.91.0.68! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
(0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Processing by HomeController#index as HTML Completed 500 Internal Server Error in 15ms (ActiveRecord: 0.0ms)

Errno::ECONNREFUSED (Failed to open TCP connection to localhost:7557 (Connection refused - connect(2) for "localhost" port 7557)): app/controllers/home_controller.rb:17:in `block (6 levels) in index'

Taazar
  • 1,545
  • 18
  • 27
Vượng
  • 3
  • 3
  • What's in `app/controllers/home_controller.rb`? – Schwern Nov 15 '18 at 07:42
  • Possible duplicate of [How to disable "Cannot Render Console from..." on Rails](https://stackoverflow.com/questions/29417328/how-to-disable-cannot-render-console-from-on-rails) – Schwern Nov 15 '18 at 07:43
  • content in "app/controllers/home_controller.rb" as below, pls let me know what i need to do fix that. Many thanks ! – Vượng Nov 15 '18 at 08:07
  • class HomeController < ApplicationController require 'util' def index can?(:read, 'home') do @graphs = Rails.cache.fetch('graphs', :expires_in => 60.seconds) do require 'net/http' require 'thread' – Vượng Nov 15 '18 at 08:07
  • threads = [] graphs = ActiveSupport::JSON.decode(ERB.new(File.read(Rails.root.join('config/graphs.json.erb'))).result) for group_name, group_graphs in graphs for graph_name, graph in group_graphs for slice in graph threads << Thread.new(slice) do |slice| http = create_api_conn() res = http.head("/devices/?query=#{CGI::escape ActiveSupport::JSON.encode(slice['query'])}") – Vượng Nov 15 '18 at 08:08
  • slice['data'] = res['Total'].to_i slice['href'] = url_for(controller: 'devices', action: 'index', params: {query: ActiveSupport::JSON.encode(slice['query'])}, only_path: true) slice.delete('query') end end end end threads.each(&:join) next graphs end end end end – Vượng Nov 15 '18 at 08:08
  • i can't attach file, pls click "edit" to view content. Thanks you ! – Vượng Nov 15 '18 at 08:09
  • Have you tried the suggestions in the possibly duplicate answer? – Schwern Nov 15 '18 at 18:56

0 Answers0