Rails PDF Generation with Prawn in IE7

后端 未结 4 959
遇见更好的自我
遇见更好的自我 2021-01-01 07:55

I\'m using Prawn and Prawnto to generate a PDF in a Ruby on Rails app (Rails version 2.2.2) which works great and generates PDFs happily and sends them to the user to downlo

4条回答
  •  猫巷女王i
    2021-01-01 08:08

    I chased my issue down to prawnto's compile_support.rb file.

      # added to make ie happy with ssl pdf's (per naisayer)
      def ssl_request?
        @controller.request.env['SERVER_PROTOCOL'].downcase == "https"
      end
    

    We were seeing that apache's SERVER_PROTCOL env variable was always set to HTTP/1.1 even when using https. When ssl_required? is false and it's a request from ie prawnto will set Pragma="no-cache". This is what was causing our issues.

    If your app only uses https you can change this function to always return true. If this isn't enough you can write an apache directive along the lines of:

    SetEnv SERVER_PROTOCOL "https"

    I put this right in my ssl.conf file and everything now works as expected.

提交回复
热议问题