サイトのサブディレクトリでの Ghost の提供に関する別の質問へようこそ!
多くのスレッドに詳細が記載されているため(まだドキュメントはありません....)、このGithubプロファイルの詳細(https://github.com/owenscott/hapi-ghost-proxy-example/blob/master )に従ってプロキシサーバーをセットアップしました/config.js )。
ルート ページを提供できますが、Ghost をサブディレクトリ ルートに表示できません。次のエラー(URLに移動するとブラウザに表示される)で正確に何が起こっているのかについて、私はかなり困惑しています:
TypeError: Parameter 'url' must be a string, not undefined
at Url.parse (url.js:107:11)
at Object.urlParse [as parse] (url.js:101:5)
at Object.common.setupOutgoing (C:\dev\projects\warpspeed\node_modules\http-proxy\lib\http-proxy\common.js:71:11)
at Array.stream [as 3] (C:\dev\projects\warpspeed\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:109:14)
at ProxyServer.<anonymous> (C:\dev\projects\warpspeed\node_modules\http-proxy\lib\http-proxy\index.js:80:21)
at ghost.config (C:\dev\projects\warpspeed\server.js:23:8)
at Layer.handle [as handle_request] (C:\dev\projects\warpspeed\node_modules\express\lib\router\layer.js:76:5)
at next (C:\dev\projects\warpspeed\node_modules\express\lib\router\route.js:100:13)
at Route.dispatch (C:\dev\projects\warpspeed\node_modules\express\lib\router\route.js:81:3)
at Layer.handle [as handle_request] (C:\dev\projects\warpspeed\node_modules\express\lib\router\layer.js:76:5)
私のserver.jsファイル(下記)に詳述されているように、ゴーストを介したルーティングと関係があると思います。
var express = require('express');
var ghost = require('ghost');
var httpProxy = require('http-proxy');
var path = require('path');
var app = express();
var proxy = new httpProxy.createProxyServer();
//routes
app.get('/', function(req, res){
res.send('Coming soon...')
});
//ghost routes
app.get('/nowhammystop', function(req, res, next){
proxy.web(res, req, {
target: 'http://localhost:22889'
});
});
//start Ghost
ghost({
config: path.join(__dirname, 'node_modules/ghost/config.js')
});
var server = app.listen(12942);
何か案は?