Class ActionController::UrlRewriter
In: lib/116.rb
lib/123.rb
lib/reverse_proxy_fix.rb
Parent: Object

Overriding the base UrlRewriter classes to get rewrite_url to always prepend the BASE_URL specified in the config file

Methods

External Aliases

rewrite_url -> old_rewrite_url

Public Instance methods

old_rewrite_url(path, options)

Alias for rewrite_url

old_rewrite_url(path, options)

Alias for rewrite_url

Prepends the BASE_URL to all of the URL requests created by the URL rewriter in Rails. This includes url_for, link_to, and route generation. Route recognition is handled in recognize_path which is modified as well.

[Source]

    # File lib/123.rb, line 35
35:                 def rewrite_url(path, options)
36: 
37:                         url = old_rewrite_url(path, options)
38:                         if ActionController::check_mode_and_base
39:                           unless options[:skip_relative_url_root]
40:                                         
41:                             url = url.gsub(@request.protocol + @request.host_with_port, '')
42:                             url = BASE_URL + url
43:                           end
44:                         end
45:                         url
46:                 
47:                 end

Prepends the BASE_URL to all of the URL requests created by the URL rewriter in Rails.

[Source]

    # File lib/116.rb, line 31
31:                 def rewrite_url(path, options)
32:                         url = old_rewrite_url(path, options)
33:                         if ActionController::check_mode_and_base
34:                           unless options[:skip_relative_url_root]
35:                                         
36:                             url = url.gsub(@request.protocol + @request.host_with_port, '')
37:                             url = BASE_URL + url
38:                           end
39:                         end
40:                         url
41:                 
42:                 end

Prepends the BASE_URL to all of the URL requests created by the URL rewriter in Rails. This includes url_for, link_to, and route generation. Route recognition is handled in recognize_path which is modified as well.

[Source]

    # File lib/reverse_proxy_fix.rb, line 35
35:                 def rewrite_url(path, options)
36: 
37:                         url = old_rewrite_url(path, options)
38:                         if ActionController::check_mode_and_base
39:                           unless options[:skip_relative_url_root]
40:                                         
41:                             url = url.gsub(@request.protocol + @request.host_with_port, '')
42:                             url = BASE_URL + url
43:                           end
44:                         end
45:                         url
46:                 
47:                 end

[Validate]