Heroku HTML 静态站点不允许json 访问?
Heroku HTML static site does not allow json access?
我正在使用 Rack::TryStatic
在 Heroku 上管理我的 site。
这是我在 github
上的 config.ru 文件
require "rack/contrib/try_static"
require "rack/contrib/not_found"
use Rack::TryStatic, {
root: "_site",
urls: %w[/],
try: %w[
.html index.html /index.html
.js .css .xml .json
.eot .svg .ttf .woff .woff2
]
}
run lambda{ |env|
four_oh_four_page = File.expand_path("../_site/404/index.html", __FILE__)
[ 404, { 'Content-Type' => 'text/html'}, [ File.read(four_oh_four_page) ]]
}
我想我已经通过在 try 数组 中添加它来允许 .json
访问,但是我的 search.json
文件得到 404 html 页面所以我的搜索工具坏了。
知道如何访问它吗?
这与 TryStatic
无关,json 文件是在 heroku 构建期间生成的,但不存在于最终构建中。
我正在使用 Rack::TryStatic
在 Heroku 上管理我的 site。
这是我在 github
上的 config.ru 文件require "rack/contrib/try_static"
require "rack/contrib/not_found"
use Rack::TryStatic, {
root: "_site",
urls: %w[/],
try: %w[
.html index.html /index.html
.js .css .xml .json
.eot .svg .ttf .woff .woff2
]
}
run lambda{ |env|
four_oh_four_page = File.expand_path("../_site/404/index.html", __FILE__)
[ 404, { 'Content-Type' => 'text/html'}, [ File.read(four_oh_four_page) ]]
}
我想我已经通过在 try 数组 中添加它来允许 .json
访问,但是我的 search.json
文件得到 404 html 页面所以我的搜索工具坏了。
知道如何访问它吗?
这与 TryStatic
无关,json 文件是在 heroku 构建期间生成的,但不存在于最终构建中。