leikind / wice_grid

A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters
MIT License
537 stars 215 forks source link

Using only_path: true in forming links #270

Open Qwertyn opened 8 years ago

Qwertyn commented 8 years ago

Hello!

Settings nginx to use SSL ( https://localhost/ ). Start the Web application server (WEBrick or unicorn) at http://localhost:3000. Got error in firefox: Mixed Content (Заблокирована загрузка смешанного активного содержимого)

2016-01-13 11 41 55

Any idea how else could solve the problem?

I made a small change:

# wice_grid/lib/wice/grid_renderer.rb
module Wice
  class GridRenderer
    def base_link_for_filter(controller, extra_parameters = {})   #:nodoc:
      ...
      new_params[:only_path] = true # <<<<<
      ...
    end

    def link_for_export(controller, format, extra_parameters = {})   #:nodoc:
      ...
      new_params[:only_path] = true # <<<<<
      ...
    end
  end
end

it worked! Please tell me why apparently used only_path: false ? That may break if you use only_path: true ?

leikind commented 8 years ago

I had WiceGrid working on SSL pages without any problems, the question is which URL is the offender? Which link is generated by the plugin with a scheme different from the scheme of the page (https)?

Qwertyn commented 8 years ago

URL, for example, http://localhost/tenants?grid%5Bf%5D%5Bstatus%5D%5B%5D=0 WEBrick works on http (port 3000) nginx - https (port 443)

Perhaps configured incorrectly nginx. You can provide a configuration file nginx?

What is the reason to use only_path: false?

leikind commented 8 years ago

please create a gist with html source code of the page which causes this error message

Qwertyn commented 8 years ago

I think this will be enough:

<div
data-processor-initializer-arguments="[
&quot;http://localhost/tenants&quot;,
&quot;http://localhost/tenants&quot;,
&quot;/tenants?grid%5Bexport%5D=csv&quot;,
&quot;grid%5Bq%5D=&quot;,
&quot;grid%5Bfoc%5D=&quot;,
&quot;production&quot;
]"
...
<div data-processor-initializer-arguments="[&quot;http://localhost/tenants&quot;,&quot;http://localhost/tenants&quot;,&quot;/tenants?grid%5Bexport%5D=csv&quot;,&quot;grid%5Bq%5D=&quot;,&quot;grid%5Bfoc%5D=&quot;,&quot;production&quot;]" data-filter-declarations="[{&quot;filterName&quot;:&quot;№&quot;,&quot;detached&quot;:&quot;false&quot;,&quot;declaration&quot;:{&quot;templates&quot;:[&quot;grid%5Bf%5D%5Bid%5D%5Beq%5D=&quot;],&quot;ids&quot;:[&quot;grid_f_id_eq&quot;]}},{&quot;filterName&quot;:&quot;№ заказа в облачной платформе&quot;,&quot;detached&quot;:&quot;false&quot;,&quot;declaration&quot;:{&quot;templates&quot;:[&quot;grid%5Bf%5D%5Border_id%5D%5Beq%5D=&quot;],&quot;ids&quot;:[&quot;grid_f_order_id_eq&quot;]}},{&quot;filterName&quot;:&quot;Название&quot;,&quot;detached&quot;:&quot;false&quot;,&quot;declaration&quot;:{&quot;templates&quot;:[&quot;grid%5Bf%5D%5Bname%5D=&quot;],&quot;ids&quot;:[&quot;grid_f_name&quot;]}},{&quot;filterName&quot;:&quot;№ заказа ВЦОД в облачной платформе&quot;,&quot;detached&quot;:&quot;false&quot;,&quot;declaration&quot;:{&quot;templates&quot;:[&quot;grid%5Bf%5D%5Bparent_order_id%5D%5Beq%5D=&quot;],&quot;ids&quot;:[&quot;grid_f_parent_order_id_eq&quot;]}},{&quot;filterName&quot;:&quot;Имя ВЦОД&quot;,&quot;detached&quot;:&quot;false&quot;,&quot;declaration&quot;:{&quot;templates&quot;:[&quot;grid%5Bf%5D%5Bvdc_name%5D=&quot;],&quot;ids&quot;:[&quot;grid_f_vdc_name&quot;]}},{&quot;filterName&quot;:&quot;Регион ВЦОД&quot;,&quot;detached&quot;:&quot;false&quot;,&quot;declaration&quot;:{&quot;templates&quot;:[&quot;grid%5Bf%5D%5Bregion%5D=&quot;],&quot;ids&quot;:[&quot;grid_f_region&quot;]}},{&quot;filterName&quot;:&quot;Система виртуализации ВЦОД&quot;,&quot;detached&quot;:&quot;false&quot;,&quot;declaration&quot;:{&quot;templates&quot;:[&quot;grid%5Bf%5D%5Bvirtualization%5D=&quot;],&quot;ids&quot;:[&quot;grid_f_virtualization&quot;]}},{&quot;filterName&quot;:&quot;Дата создания&quot;,&quot;detached&quot;:&quot;false&quot;,&quot;declaration&quot;:{&quot;templates&quot;:[&quot;grid%5Bf%5D%5Bcreated_at%5D%5Bfr%5D=&quot;,&quot;grid%5Bf%5D%5Bcreated_at%5D%5Bto%5D=&quot;],&quot;ids&quot;:[&quot;grid_f_created_at_fr&quot;,&quot;grid_f_created_at_to&quot;]}},{&quot;filterName&quot;:&quot;Статус&quot;,&quot;detached&quot;:&quot;false&quot;,&quot;declaration&quot;:{&quot;templates&quot;:[&quot;grid%5Bf%5D%5Bstatus%5D%5B%5D=&quot;],&quot;ids&quot;:[&quot;grid_f_status&quot;]}}]" class="wg-data"></div></div>
leikind commented 8 years ago

No, that is definitely not enough. At least the whole WG code is needed, or the whole page.

Qwertyn commented 8 years ago

To solve the problem turned out to be enough to add the settings nginx:

proxy_set_header  X-Forwarded-Proto $scheme;

Thanks!

But it is interesting why can not use only_path: true?