why Ajax.Updater missed https to http

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anaconda1977
    New Member
    • Apr 2010
    • 8

    why Ajax.Updater missed https to http

    From client side, I access with https. In my code

    Code:
    alert(location.protocol)   // pop up https
    
    new Ajax.Updater("sip_tab_content",
                        "/rails/test_modules/show/" + $F("boardid"),                    
                        {method :'get',
                          onFailure:displaySIPTabFailure,
                          onComplete:displaySIPTabFailure
                        });


    On server side, is ruby on rails:

    Code:
    def show
        @test_module = TestModule.find(params[:id])
    File.open("C:\\rubylog.txt", 'w') {|f| f.write(request.url)}    # I get http://.......  here
        respond_to do |format|
          format.html # show.html.erb
          format.xml  { render :xml => @test_module }
        end
      end
    I don't know whether Ajax.Updater missed my https. I found articles saying: Ajax.Updater is from Ajax.Request and the latter is from XMLHttpRequest, and XMLHttpRequest can transmit on both http and https. Then where is the problem??

    Anyone know?

    thanks.
    Last edited by acoder; May 9 '10, 03:58 PM. Reason: Added [code] tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    If you access the Ruby on Rails page directly (without using Ajax Updater), does it display https or http?

    Comment

    • anaconda1977
      New Member
      • Apr 2010
      • 8

      #3
      It displayed a http web page. I don't know why.
      The second piece of code is in rails/app/controllers foulder(MVC). I think the show function(define d in class derived from ApplicationCont roller) is the first step to run after got the request.I think the Ajax.Updater may use port 443, and I catch request.port (in edit ) as 80.
      Does the RoR change it by using default? I didn't know whether there's a default setting on RoR using http instead of https if something not complete?

      Comment

      • anaconda1977
        New Member
        • Apr 2010
        • 8

        #4
        acoder: Sorry to make a wrong conclusion. I didn't try "access the Ruby on Rails page directly". when I say "it displayed a http web page", it means nothing, forget it. However you may have reminded me of something.

        For the RoR only act as the server side and the client side is a javascript file, request.url may take no meaning. In fact, my http mode has been banned by me. However, the next page the edit function displayed is OK without warning(that is the page is displayed as https). So even request.port == 80 and request.url take http, that only an initial value when RoR initialized its service I think.
        Last edited by Niheel; May 10 '10, 11:26 AM. Reason: punctuation

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          So that probably means there's no problem, though it may be a good idea to find out why it's request.url is returning "http" instead of "https".

          To confirm, you may want to ask in the Ruby/Rails forum, if you haven't already done so.

          Comment

          Working...