Heroku+jekyll部署追加index.html到AJAXpost
Heroku+jekyll deployment appends index.html to AJAX post
我有一个 ajax 呼叫 post 到 /php/rsvp.php
。由于某种原因,当此调用通过 Web 服务器时,index.html 会附加到路径上。该应用程序使用 puma 托管在 heroku 上。带有堆栈跟踪的日志如下:
2015-10-12T01:48:57.898961+00:00 heroku[router]: at=info method=POST path="/php/rsvp.php" host= request_id= fwd="" dyno=web.1 connect=1ms service=9ms status=500 bytes=168
2015-10-12T01:48:57.901579+00:00 app[web.1]: 2015-10-12 01:48:57 +0000: Rack app error: #<Errno::ENOTDIR: Not a directory @ rb_sysopen - /app/_site/php/rsvp.php/index.html>
2015-10-12T01:48:57.901635+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-jekyll-0.4.1/lib/rack/jekyll/helpers.rb:14:in `initialize'
2015-10-12T01:48:57.901639+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-jekyll-0.4.1/lib/rack/jekyll/helpers.rb:14:in `open'
2015-10-12T01:48:57.901640+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-jekyll-0.4.1/lib/rack/jekyll/helpers.rb:14:in `file_info'
2015-10-12T01:48:57.901642+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-jekyll-0.4.1/lib/rack/jekyll.rb:75:in `call'
2015-10-12T01:48:57.901644+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/puma-2.9.1/lib/puma/configuration.rb:71:in `call'
2015-10-12T01:48:57.901645+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/puma-2.9.1/lib/puma/server.rb:490:in `handle_request'
2015-10-12T01:48:57.901647+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/puma-2.9.1/lib/puma/server.rb:361:in `process_client'
2015-10-12T01:48:57.901649+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/puma-2.9.1/lib/puma/server.rb:254:in `block in run'
2015-10-12T01:48:57.901652+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/puma-2.9.1/lib/puma/thread_pool.rb:92:in `call'
2015-10-12T01:48:57.901692+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/puma-2.9.1/lib/puma/thread_pool.rb:92:in `block in spawn_thread'
我一直在查看 puma 和 rack-jekyll 函数以查找追加发生的位置,但是 none 的条件是有意义的。我还没有在这个问题上找到任何其他 post,这让我觉得我正在监督一些简单的事情。 ajax 调用非常简单:
req = $.post( '/rsvp.php', $form.serialize(), function(data, status){});
我是否缺少一些配置来防止这种情况发生?我的 Gemfile、_config.yml、config.ru 等与 here.
相同
所以我们也遇到了这个问题,只是刚刚弄明白了。问题是 rack-jekyll
gem 有一个错误,它假设没有 mime 类型的文件是目录。查看问题:https://github.com/adaoraul/rack-jekyll/issues/38
错误修复已经完成,它似乎会与 0.4.3 一起发布,但与此同时我们通过将以下行添加到我们的 config.ru 文件中设法解决了这个问题,这增加了.php 扩展名的 mime 类型:
Rack::Mime::MIME_TYPES.merge!({".php" => "application/octet-stream"})
我有一个 ajax 呼叫 post 到 /php/rsvp.php
。由于某种原因,当此调用通过 Web 服务器时,index.html 会附加到路径上。该应用程序使用 puma 托管在 heroku 上。带有堆栈跟踪的日志如下:
2015-10-12T01:48:57.898961+00:00 heroku[router]: at=info method=POST path="/php/rsvp.php" host= request_id= fwd="" dyno=web.1 connect=1ms service=9ms status=500 bytes=168
2015-10-12T01:48:57.901579+00:00 app[web.1]: 2015-10-12 01:48:57 +0000: Rack app error: #<Errno::ENOTDIR: Not a directory @ rb_sysopen - /app/_site/php/rsvp.php/index.html>
2015-10-12T01:48:57.901635+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-jekyll-0.4.1/lib/rack/jekyll/helpers.rb:14:in `initialize'
2015-10-12T01:48:57.901639+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-jekyll-0.4.1/lib/rack/jekyll/helpers.rb:14:in `open'
2015-10-12T01:48:57.901640+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-jekyll-0.4.1/lib/rack/jekyll/helpers.rb:14:in `file_info'
2015-10-12T01:48:57.901642+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-jekyll-0.4.1/lib/rack/jekyll.rb:75:in `call'
2015-10-12T01:48:57.901644+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/puma-2.9.1/lib/puma/configuration.rb:71:in `call'
2015-10-12T01:48:57.901645+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/puma-2.9.1/lib/puma/server.rb:490:in `handle_request'
2015-10-12T01:48:57.901647+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/puma-2.9.1/lib/puma/server.rb:361:in `process_client'
2015-10-12T01:48:57.901649+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/puma-2.9.1/lib/puma/server.rb:254:in `block in run'
2015-10-12T01:48:57.901652+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/puma-2.9.1/lib/puma/thread_pool.rb:92:in `call'
2015-10-12T01:48:57.901692+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/puma-2.9.1/lib/puma/thread_pool.rb:92:in `block in spawn_thread'
我一直在查看 puma 和 rack-jekyll 函数以查找追加发生的位置,但是 none 的条件是有意义的。我还没有在这个问题上找到任何其他 post,这让我觉得我正在监督一些简单的事情。 ajax 调用非常简单:
req = $.post( '/rsvp.php', $form.serialize(), function(data, status){});
我是否缺少一些配置来防止这种情况发生?我的 Gemfile、_config.yml、config.ru 等与 here.
相同所以我们也遇到了这个问题,只是刚刚弄明白了。问题是 rack-jekyll
gem 有一个错误,它假设没有 mime 类型的文件是目录。查看问题:https://github.com/adaoraul/rack-jekyll/issues/38
错误修复已经完成,它似乎会与 0.4.3 一起发布,但与此同时我们通过将以下行添加到我们的 config.ru 文件中设法解决了这个问题,这增加了.php 扩展名的 mime 类型:
Rack::Mime::MIME_TYPES.merge!({".php" => "application/octet-stream"})