1

I come from this post: Rails using puma, change localhost:3000 to localhost:3000/example

I have fixed this issue, but now I receive "Method not allowed" when I do a post request. I have been reading and tried this solution: Post returns 405 method not allowed

I know where is the problem: If I put in application.rb lines 1- and 2-, all assets are shown correctly and post methods aren't doing it. If I comment these lines, methods works but assets don't.

Application.rb:

class Application < Rails::Application
    # Initialize configuration defaults for originally generated Rails version.
    config.load_defaults 5.1

    config.exceptions_app = ->(env) { ExceptionController.action(:show).call(env) }
    config.action_dispatch.rescue_responses["BadTaste"] = :bad_request

    1- config.action_controller.asset_host = "https://www.sevilla.org"
    2- config.assets.prefix = '/autorizaciones-movilidad'
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.
  end

Routes:

Rails.application.routes.draw do
    #resources :assets, path: '/autorizaciones-movilidad'
    scope "/autorizaciones-movilidad" do
      get 'vehicles/new'
      get 'vehicles/create'
      ...
      get 'vehicles/update'
    end
end

Controller structure: controller

Don't know how to solve it.

It is deployed with a proxy server (in localhost it was working ok)

0 Answers0