Reputation: 183
When I launch my application in production, there is a mistake on each url GET action, like that (double slash) :
GET "//assets/images/
Started GET "//" for 90.85.118.245 at 2015-09-11 12:23:03 +0200
In each local environments (development, stage, production), there are no mistakes :
Started GET "/" for 127.0.0.1
Where can I modify Url GET action in my application ?
Here's my environment/production.rb :
MyApp::Application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_mailer.default_url_options = {:host => "my-website.com"}
config.action_mailer.delivery_method = :sendmail
config.action_mailer.sendmail_settings = {arguments: '-i'}
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.serve_static_files = true
config.assets.compress = true
config.assets.css_compressor = :sass
config.assets.compile = true
config.assets.debug = true
config.assets.digest = true
config.force_ssl = true
config.log_level = :debug
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ::Logger::Formatter.new
config.active_record.dump_schema_after_migration = false
end
EDIT
@SashaEgorov
Thanks for your answer, here's the result with the gem 'rack-mini-profiler' in production :
Rack Environment
---------------
SCRIPT_NAME:
QUERY_STRING: pp=env
SERVER_NAME: MyName
SERVER_PORT: 8080
REQUEST_METHOD: GET
PATH_INFO: /
REQUEST_URI: //?pp=env
SERVER_PROTOCOL: HTTP/1.1
REMOTE_ADDR: 127.0.0.1
HTTP_HOST: www.my-app.com
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_IF_NONE_MATCH:
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.4.10 (KHTML, like Gecko) Version/8.0.4 Safari/600.4.10
HTTP_ACCEPT_LANGUAGE: fr-fr
HTTP_X_FORWARDED_PROTO: https
HTTP_COOKIE: __profilin=p%3Dt; _ydomain_session=S3BweEp2UFc1cWdnamR0cUFqUCtVODRyc2lrcXVtb0NBY2prWFpEVExkbk9LNlVnVGlVQXo1dUxaVE92dwwwwwwwwwwwlRwUENrcnJjd0hIZG9XbkxuSTdnMWJOeFppQ2IrT00xeThLMVkzNkI0cU9zREF3bzUrY2xQQXI2OXFUMlozUmpsbEZiYjdTOS9XamVjbzZnPT0tLWl6ZWM3MnJYdktBWU9FeFByMDhxS0E9PQ%3D%3D--579a5c445f4ea3576f7ea0e497e0f9669d6ff4d1; cookieconsent_dismissed=yes; mp_c7edba6d838242f87861aaaabcb2c775_mixpanel=%7B%22distinct_id%22%3A%20%2214d8aef81ae293-0ffd2c739-7a7b3b63-fa000-14d8aef81af2a%22%2C%22%24search_engine%22%3A%20%22google%22%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Fwww.google.fr%2F%22%2C%22%24initial_referring_domain%22%3A%20%22www.google.fr%22%7D
HTTP_ACCEPT_ENCODING: gzip
HTTP_X_COUNTRY_CODE: FR
HTTP_X_FORWARDED_FOR: 90.85.118.245
HTTP_X_FORWARDED_SSL: on
HTTP_CONNECTION: close
rack.version: [1, 1]
rack.url_scheme: https
rack.multithread: false
rack.multiprocess: true
rack.run_once: false
rack.input: #<Uwsgi_IO:0x00xxx009cf22a0>
rack.errors: #<IO:0x000xxx09cf2200>
uwsgi.core: 0
uwsgi.version: 2.0.11.1
uwsgi.node: mydomain
ORIGINAL_FULLPATH: //?pp=env
ORIGINAL_SCRIPT_NAME:
action_dispatch.routes: # <ActionDispatch::Routing::RouteSet:0x00000006xxx858>
action_dispatch.parameter_filter: [:password]
action_dispatch.redirect_filter: []
action_dispatch.secret_token: f8fd540a80d0cde33472255143552bfd31ecb90bf5xxxxxxxxxxxxx8ea6f349b57023f2dc1d93ebfxxxxxxxxx95dad1bxxxxxxxxxxx06df0d9ce5e40ee007
action_dispatch.secret_key_base: 93dd2cxxxxxxxxxxxxxxxxxxxxxxxxxxxfbfa7bc6b06cd388d5eadd97abb292f1128ff868cf80be00485bcb43666273b3f3a6e46d3cdf562dfad03c
action_dispatch.show_exceptions: true
action_dispatch.show_detailed_exceptions: false
action_dispatch.logger: #<ActiveSupport::Logger:0x0000000xxxxf10>
action_dispatch.backtrace_cleaner: #<Rails::BacktraceCleaner:0x00000xxxx6fcb0>
action_dispatch.key_generator: #<ActiveSupport::CachingKeyGenerator:0x0000000xxxxxf0>
action_dispatch.http_auth_salt: http authentication
action_dispatch.signed_cookie_salt: signed cookie
action_dispatch.encrypted_cookie_salt: encrypted cookie
action_dispatch.encrypted_signed_cookie_salt: signed encrypted cookie
action_dispatch.cookies_serializer: json
action_dispatch.cookies_digest:
ROUTES_51833900_SCRIPT_NAME:
rack.request.cookie_hash: {"__profilin"=>"p=t", "_wileoo_session"=>"S3BweEp2UFc1cWdnamR0cUFqUCtVODRyc2lrcXVtb0NBY2prWFpEVExkbk9LNlVnVGlVQXo1dUxaVExxxxxxxxxxxxxxQlRwUENrcnJjd0hIZG9XbkxuSTdnMWJOeFppQ2IrT00xeThLMVkzNkI0cU9zREF3bzUrY2xQQXI2OXFUMlozUmpsbEZiYjdTOS9XamVjbzZnPT0tLWl6ZWM3MnJYdktBWU9FeFByMDhxS0E9PQ==--579a5c445f4ea3576f7ea0e497e0f9669d6ff4d1", "cookieconsent_dismissed"=>"yes", "mp_c7edba6d838242f87861aaaabcb2c775_mixpanel"=>"{\"distinct_id\": \"14d8aef81ae293-0ffd2c739-7a7b3b63-fa000-14d8aef81af2a\",\"$search_engine\": \"google\",\"$initial_referrer\": \"https://www.google.fr/\",\"$initial_referring_domain\": \"www.google.fr\"}"}
rack.request.cookie_string: __profilin=p%3Dt; _ydomain_session=S3BweEp2UFc1cWdnamR0cUFqUCtVODRyc2lrcXVtb0NBY2prWFpEVExkbk9LNlVnVGlVQXo1dUxaVE92djhCMWl1TnB5QlRwUENrcnJjd0hIZG9XbkxuSTdnMWJOeFppQ2IrT00xeThLMVkzNkI0cxxxxxxxxxxxxxxxxxxxxxxxxUMlozUmpsbEZiYjdTOS9XamVjbzZnPT0tLWl6ZWM3MnJYdktBWU9FeFByMDhxS0E9PQ%3D%3D--579a5c445f4ea3576f7ea0e497e0f9669d6ff4d1; cookieconsent_dismissed=yes; mp_c7edba6d838242f87861aaaabcb2c775_mixpanel=%7B%22distinct_id%22%3A%20%2214d8aef81ae293-0ffd2c739-7a7b3b63-fa000-14d8aef81af2a%22%2C%22%24search_engine%22%3A%20%22google%22%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Fwww.google.fr%2F%22%2C%22%24initial_referring_domain%22%3A%20%22www.google.fr%22%7D
RACK_MINI_PROFILER_ORIGINAL_SCRIPT_NAME:
HTTP_IF_MODIFIED_SINCE:
action_dispatch.request_id: 261662cd-7b6e-4xxxx8-dc5b8534bcbc
action_dispatch.remote_ip: 90.85.xxxx.245
rack.session: #<ActionDispatch::Request::Session:0x00000009cxxxdc0>
rack.session.options: # <ActionDispatch::Request::Session::Options:0x00000009cf4d70>
warden: Warden::Proxy:8xxxx0240 @config={:default_scope=>:model, :scope_defaults=>{}, :default_strategies=>{:model=>[:rememberable, :database_authenticatable], :user=>[:rememberable, :database_authenticatable]}, :intercept_401=>false, :failure_app=>#<Devise::Delegator:0x00000007cd0620>}
action_dispatch.request.path_parameters: {:controller=>"welcome", :action=>"index"}
action_controller.instance: #<WelcomeController:0x00000009cface8>
action_dispatch.request.content_type:
action_dispatch.request.request_parameters: {}
rack.request.query_string: pp=env
rack.request.query_hash: {"pp"=>"env"}
action_dispatch.request.query_parameters: {"pp"=>"env"}
action_dispatch.request.parameters: {"pp"=>"env", "controller"=>"welcome", "action"=>"index"}
action_dispatch.request.formats: [text/html]
action_dispatch.cookies: # <ActionDispatch::Cookies::CookieJar:0x00000009f01a50>
action_dispatch.request.unsigned_session_cookie: {"session_id"=>"c90c3016f0dfbec6316d0a15f7104f61", "_csrf_token"=>"pPCpY4IQio91hEoqu4ngwThwbgT7RfCy5OVn79ghJL4="}
action_dispatch.request.flash_hash: #<ActionDispatch::Flash::FlashHash:0x0000000a205bc0>
Environment
---------------
PAAS_USER: hosting-user
TMPDIR: /srv/data/tmp
GITWEB_USER: hosting-user
LD_PRELOAD: /usr/local/lib/gandi/gandi-preload.so
WWW_ENGINE: ruby
DB_ENGINE: mysql
LC_ALL: C
LOCAL_DIR: /srv/run
PAAS: lamp0
PHP_USER: hosting-user
PATH: /srv/data/web/vhosts/default/vendor/bundle/ruby/1.9.1/bin:/usr/sbin:/usr/bin:/sbin/:/bin
_: /sbin/capsh
LOGROTATE_CONF: /srv/data/var/admin/logrotate.conf
PWD: /srv/data
LANG: C
APP_USER: hosting-app0
HOME: /srv/data
SHLVL: 2
MAX_MEM: 512
DB_USER: hosting-db
SYS_USER: hosting-admin
CUSTOMER_DIR: /srv/data
container: lxc
UWSGI_RELOADS: 2
UWSGI_ORIGINAL_PROC_NAME: /usr/bin/uwsgi
RACK_ENV: production
RAILS_ENV: production
GEM_PATH:
GEM_HOME: /srv/data/web/vhosts/default/vendor/bundle/ruby/1.9.1
BUNDLE_BIN_PATH: /usr/lib/ruby/bin/bundle
BUNDLE_GEMFILE: /srv/data/web/vhosts/default/Gemfile
RUBYOPT: -I/usr/lib/ruby/vendor_ruby -rbundler/setup
stripe_publishable_key: pk_live_4xxxxxxxxxxxxxxxxxxxx
stripe_secret_key: sk_live_xxxxxxxxxxxxxxxxxxxxxxxx
SECRET_TOKEN: f8fd540a80d0cde3xxxxxxxxxxxxxxxxxxxx42ed8ea6f349b57023f2dc1d93ebf3d3b96c93295dad1be2bed76a01c06df0d9ce5e40ee007
Ruby Version
---------------
1.9.3 p194
Internals
---------------
Storage Provider #<Rack::MiniProfiler::FileStore:0x000xxxxxxxx48>
User 90.85xxxxxx
Upvotes: 0
Views: 570
Reputation: 1862
Here more suggestions for debugging and finding root cause.
Check your links generated by Rails
If incorrect value for host passed by reverse proxy server or something before your rails app it will be handled by Rails as is e.g.:
>> default_url_options[:host] = "foobar"
=> "foobar"
>> episodes_url
=> "http://foobar/episodes"
>> default_url_options[:host] = "foobar/"
=> "foobar/"
>> episodes_url
=> "http://foobar//episodes"
Next try to check environment under microscope. Use gem 'rack-mini-profiler'. There is a nice screencast by Ryan Bates about it. Please consider to install it on production bacause by default it work on development environment only.
After it installed you can visit http://localhost:3000/?pp=env to examine your production environment:
Rack Environment
---------------
rack.version: [1, 3]
rack.errors: #<IO:0x007fcc198dab48>
rack.multithread: true
rack.multiprocess: false
rack.run_once: false
SCRIPT_NAME:
QUERY_STRING: pp=env
SERVER_PROTOCOL: HTTP/1.1
SERVER_SOFTWARE: 2.13.4
GATEWAY_INTERFACE: CGI/1.2
REQUEST_METHOD: GET
REQUEST_PATH: /
REQUEST_URI: /?pp=env
HTTP_VERSION: HTTP/1.1
HTTP_HOST: localhost:3000
HTTP_CONNECTION: keep-alive
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
HTTP_REFERER: http://localhost:3000/?pp=help
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4
HTTP_COOKIE: _radiobigdata_session=SzJnR296NnFuVFNoVDh0TUZycTdTRVlDVHZxTnQvdjBJaWxIUjdWUVJSdk5INnJqWlBDTG4vZFlWZjFDUU5XWXhWb1hWb2lpTkIvTkpkM1M5R1Btay80WkxkUmo4emxVRGpPOWhnek9ma3dkenFqaTlvSnBEVWRkWkZYNU9KTWFwTWRUdUdKZ2JlOGgvOGFOVjhCQW53PT0tLWphb3VzRm5McEJJczZiWlk1dFZvR1E9PQ%3D%3D--e40ab2b34d66998d440b8adb81ca718a1d7dad48; __profilin=p%3Dt
SERVER_NAME: localhost
SERVER_PORT: 3000
PATH_INFO: /
REMOTE_ADDR: 127.0.0.1
Check out all variable related to hostname. Most common practice it's to prepare four outputs: root_url
and some link produced by both development and production environments.
I think it may help to find update or even answer. Looking forward for update.
Upvotes: 1
Reputation: 7482
You can use Web Developer Console in Chrome or Firefox to view all requests to your site. Open Net panel and sort by url. It can be also some js code that gets included only in production (ad banner, for example).
Upvotes: 0