javascript - Mixed Content Error when sending Ajax request to Rails server on Heroku -
i working on rails app , using ajax update page part of live search feature. code works locally when push heroku see following error occurs when ajax request fired:
mixed content: page @ 'https://hipster-meet.herokuapp.com/users' loaded on https, requested insecure xmlhttprequest endpoint 'http://hipster-meet.herokuapp.com/users?query=a'. request has been blocked; content must served on https
i serving jquery through asset pipeline.
in production.rb
have included line:
config.force_ssl = true
this javascript sending request:
ready = -> $('.search-field').keyup -> query = $('.search-field').val() $.getjson('/users', {query: query}) return $(document).ajaxsuccess (e, xhr, options, data) -> resultarea = $('.search-results') if data.length resultlist = data.map (user)-> return '<li class="result-item">' + user.username + '<hr/></li>' resultarea.html resultlist else resultarea.html '<h5 class="text text-center">no results, sorry.</h5>' return return return $(document).ready(ready) $(document).on('page:load', ready)
i tried including force_ssl
in application_controller.rb
error persists.
any ideas on doing wrong?
Comments
Post a Comment