ruby-on-rails - ActionDispatch::HostAuthorization::DefaultResponseApp 被阻止的主机:xxxxxx.herokuapp.com

标签 ruby-on-rails ruby heroku ruby-on-rails-7 aws-cloud9

将 Ruby on Rails 更新到 Ruby 3.1.2 和 Rails 7.0.4 - 我让它在我的 IDE 中运行(开发) - 在 Heroku 上出现 HTTP ERROR 403 页面,这是一个带有重新加载按钮的浅灰色屏幕。谁能告诉我我搞砸了什么?

Access to xxxxxxxxx.herokuapp.com was denied
You don't have authorization to view this page.
HTTP ERROR 403

Acess denied on heroku screenshot

我在 Heroku 日志中看到了这一点:

[ActionDispatch::HostAuthorization::DefaultResponseApp] Blocked host: leafletmapping.herokuapp.com

这是它的屏幕截图: enter image description here

这是我的 Gemfile:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 7.0.0'
#ruby '2.6.3'
#ruby '2.7.6'
ruby '3.1.2'
# Use sqlite3 as the database for Active Record
gem 'devise'
#gem 'sqlite3'
# Use Puma as the app server
gem "puma"
# Use SCSS for stylesheets
#gem 'sass-rails', '~> 5.0'
gem 'sassc'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
#gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

gem "nokogiri", ">= 1.10.8"

#bootstrap it up
gem 'twitter-bootstrap-rails'
gem 'devise-bootstrap-views'

#for image uploading
gem 'carrierwave'
gem 'mini_magick'
gem 'fog-aws'

#for counting queries
gem 'sql_queries_count'

gem 'mimemagic', '~> 0.4.3'

gem 'sprockets-rails', :require => 'sprockets/railtie'

#gem 'pg', '~> 0.21'
#gem 'pg', '~> 1.4', '>= 1.4.2'
gem 'pg'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  #gem 'sqlite3', '~> 1.3.6'
  gem 'byebug', platform: :mri
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console'
  gem 'listen'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  #gem 'spring-watcher-listen', '~> 2.0.0'
end

group :production do
  gem 'rails_12factor'
  gem 'wkhtmltopdf-heroku'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

这是我的 gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (7.0.4)
      actionpack (= 7.0.4)
      activesupport (= 7.0.4)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailbox (7.0.4)
      actionpack (= 7.0.4)
      activejob (= 7.0.4)
      activerecord (= 7.0.4)
      activestorage (= 7.0.4)
      activesupport (= 7.0.4)
      mail (>= 2.7.1)
      net-imap
      net-pop
      net-smtp
    actionmailer (7.0.4)
      actionpack (= 7.0.4)
      actionview (= 7.0.4)
      activejob (= 7.0.4)
      activesupport (= 7.0.4)
      mail (~> 2.5, >= 2.5.4)
      net-imap
      net-pop
      net-smtp
      rails-dom-testing (~> 2.0)
    actionpack (7.0.4)
      actionview (= 7.0.4)
      activesupport (= 7.0.4)
      rack (~> 2.0, >= 2.2.0)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.2.0)
    actiontext (7.0.4)
      actionpack (= 7.0.4)
      activerecord (= 7.0.4)
      activestorage (= 7.0.4)
      activesupport (= 7.0.4)
      globalid (>= 0.6.0)
      nokogiri (>= 1.8.5)
    actionview (7.0.4)
      activesupport (= 7.0.4)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activejob (7.0.4)
      activesupport (= 7.0.4)
      globalid (>= 0.3.6)
    activemodel (7.0.4)
      activesupport (= 7.0.4)
    activerecord (7.0.4)
      activemodel (= 7.0.4)
      activesupport (= 7.0.4)
    activestorage (7.0.4)
      actionpack (= 7.0.4)
      activejob (= 7.0.4)
      activerecord (= 7.0.4)
      activesupport (= 7.0.4)
      marcel (~> 1.0)
      mini_mime (>= 1.1.0)
    activesupport (7.0.4)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 1.6, < 2)
      minitest (>= 5.1)
      tzinfo (~> 2.0)
    addressable (2.8.1)
      public_suffix (>= 2.0.2, < 6.0)
    bcrypt (3.1.18)
    bindex (0.8.1)
    builder (3.2.4)
    byebug (11.1.3)
    carrierwave (2.2.3)
      activemodel (>= 5.0.0)
      activesupport (>= 5.0.0)
      addressable (~> 2.6)
      image_processing (~> 1.1)
      marcel (~> 1.0.0)
      mini_mime (>= 0.1.3)
      ssrf_filter (~> 1.0)
    coffee-rails (5.0.0)
      coffee-script (>= 2.2.0)
      railties (>= 5.2.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    commonjs (0.2.7)
    concurrent-ruby (1.1.10)
    crass (1.0.6)
    date (3.3.1)
    devise (4.8.1)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0)
      responders
      warden (~> 1.2.3)
    devise-bootstrap-views (1.1.0)
    erubi (1.11.0)
    excon (0.94.0)
    execjs (2.8.1)
    ffi (1.15.5)
    fog-aws (3.15.0)
      fog-core (~> 2.1)
      fog-json (~> 1.1)
      fog-xml (~> 0.1)
    fog-core (2.3.0)
      builder
      excon (~> 0.71)
      formatador (>= 0.2, < 2.0)
      mime-types
    fog-json (1.2.0)
      fog-core
      multi_json (~> 1.10)
    fog-xml (0.1.4)
      fog-core
      nokogiri (>= 1.5.11, < 2.0.0)
    formatador (1.1.0)
    globalid (1.0.0)
      activesupport (>= 5.0)
    i18n (1.12.0)
      concurrent-ruby (~> 1.0)
    image_processing (1.12.2)
      mini_magick (>= 4.9.5, < 5)
      ruby-vips (>= 2.0.17, < 3)
    jbuilder (2.11.5)
      actionview (>= 5.0.0)
      activesupport (>= 5.0.0)
    jquery-rails (4.5.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    less (2.6.0)
      commonjs (~> 0.2.7)
    less-rails (4.0.0)
      actionpack (>= 4)
      less (~> 2.6.0)
      sprockets (>= 2)
    listen (3.7.1)
      rb-fsevent (~> 0.10, >= 0.10.3)
      rb-inotify (~> 0.9, >= 0.9.10)
    loofah (2.19.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.8.0)
      mini_mime (>= 0.1.1)
      net-imap
      net-pop
      net-smtp
    marcel (1.0.2)
    method_source (1.0.0)
    mime-types (3.4.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2022.0105)
    mimemagic (0.4.3)
      nokogiri (~> 1)
      rake
    mini_magick (4.12.0)
    mini_mime (1.1.2)
    mini_portile2 (2.8.0)
    minitest (5.16.3)
    multi_json (1.15.0)
    net-imap (0.3.2)
      date
      net-protocol
    net-pop (0.1.2)
      net-protocol
    net-protocol (0.2.1)
      timeout
    net-smtp (0.3.3)
      net-protocol
    nio4r (2.5.8)
    nokogiri (1.13.10)
      mini_portile2 (~> 2.8.0)
      racc (~> 1.4)
    orm_adapter (0.5.0)
    pg (1.4.5)
    public_suffix (5.0.1)
    puma (6.0.0)
      nio4r (~> 2.0)
    racc (1.6.1)
    rack (2.2.4)
    rack-test (2.0.2)
      rack (>= 1.3)
    rails (7.0.4)
      actioncable (= 7.0.4)
      actionmailbox (= 7.0.4)
      actionmailer (= 7.0.4)
      actionpack (= 7.0.4)
      actiontext (= 7.0.4)
      actionview (= 7.0.4)
      activejob (= 7.0.4)
      activemodel (= 7.0.4)
      activerecord (= 7.0.4)
      activestorage (= 7.0.4)
      activesupport (= 7.0.4)
      bundler (>= 1.15.0)
      railties (= 7.0.4)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.4.3)
      loofah (~> 2.3)
    rails_12factor (0.0.3)
      rails_serve_static_assets
      rails_stdout_logging
    rails_serve_static_assets (0.0.5)
    rails_stdout_logging (0.0.5)
    railties (7.0.4)
      actionpack (= 7.0.4)
      activesupport (= 7.0.4)
      method_source
      rake (>= 12.2)
      thor (~> 1.0)
      zeitwerk (~> 2.5)
    rake (13.0.6)
    rb-fsevent (0.11.2)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    responders (3.0.1)
      actionpack (>= 5.0)
      railties (>= 5.0)
    ruby-vips (2.1.4)
      ffi (~> 1.12)
    sassc (2.4.0)
      ffi (~> 1.9)
    spring (4.1.0)
    sprockets (4.1.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.4.2)
      actionpack (>= 5.2)
      activesupport (>= 5.2)
      sprockets (>= 3.0.0)
    sql_queries_count (0.0.1)
      rails (> 3.0.0)
    ssrf_filter (1.1.1)
    thor (1.2.1)
    timeout (0.3.1)
    twitter-bootstrap-rails (5.0.0)
      actionpack (>= 5.0, < 8.0)
      execjs (~> 2.7)
      less-rails (>= 3.0, < 5.0)
      railties (>= 5.0, < 8.0)
    tzinfo (2.0.5)
      concurrent-ruby (~> 1.0)
    uglifier (4.2.0)
      execjs (>= 0.3.0, < 3)
    warden (1.2.9)
      rack (>= 2.0.9)
    web-console (4.2.0)
      actionview (>= 6.0.0)
      activemodel (>= 6.0.0)
      bindex (>= 0.4.0)
      railties (>= 6.0.0)
    websocket-driver (0.7.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    wkhtmltopdf-heroku (2.12.6.0)
    zeitwerk (2.6.6)

PLATFORMS
  ruby

DEPENDENCIES
  byebug
  carrierwave
  coffee-rails
  devise
  devise-bootstrap-views
  fog-aws
  jbuilder
  jquery-rails
  listen
  mimemagic (~> 0.4.3)
  mini_magick
  nokogiri (>= 1.10.8)
  pg
  puma
  rails (~> 7.0.0)
  rails_12factor
  sassc
  spring
  sprockets-rails
  sql_queries_count
  twitter-bootstrap-rails
  tzinfo-data
  uglifier
  web-console
  wkhtmltopdf-heroku

RUBY VERSION
   ruby 3.1.2p20

BUNDLED WITH
   2.3.7

最佳答案

我需要将此行添加到/config/product.rb

config.hosts << "leafletmapping.herokuapp.com"

我最初将其放在/config/application.rb 中 - 我将其移至/config/development.rb 中:

config.hosts << "xxxxxxxxxxxxxx895bda14328ae38a.vfs.cloud9.us-east-1.amazonaws.com"

Beartech 在上面的评论中回答了这个问题: 请注意,该链接是关于 localhost 无法正常工作的,但您的问题可能恰恰相反。因此,请查看这篇文章以及它在 config/environments/development.rb 中指向的内容以及在 production.rb 中指向的内容。 –Beartech

关于ruby-on-rails - ActionDispatch::HostAuthorization::DefaultResponseApp 被阻止的主机:xxxxxx.herokuapp.com,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74747702/

相关文章:

database - Postgres 将 Heroku 生产数据库复制到本地开发数据库

ruby-on-rails - Rails 3 和设计 : Redirecting to page following signup (confirmable)

ruby-on-rails - Rails无法解析有效的YAML文件

javascript - Rails - 无法访问表单中的实例变量

ruby-on-rails - 有没有办法使用 Ruby map (& :method) shorthand for passing a key to all the hashes in an array?

reactjs - Heroku 没有这样的文件或目录,stat '/app/client/build/index.html'

ruby-on-rails - 如何配置Haml的:markdown filter to use Redcarpet with options?

ruby-on-rails - Capybara + RSpec 只能在 Controller 规范中看到空白页。为什么?

ruby-on-rails - 谷歌身份验证错误 Ruby on Rails

node.js - 引用错误 : DATABASE_URL is not defined when trying to connect to heroku postgres db using Sequelize