简体   繁体   English

如何在不修改API地址的情况下重新路由Ghost Blog管理员URL?

[英]How do I Re-route Ghost Blog Admin URL without modifying the API Address?

Ghost blog platform has a setting that allows you to change the admin panel login location (which starts as: https://whateveryoursiteis.com/ghost ). Ghost博客平台的设置可让您更改管理面板的登录位置(以https://whateveryoursiteis.com/ghost开头)。 Methodology / docs for changing that setting can be found here: https://docs.ghost.org/concepts/config/#admin-url 可以在以下位置找到用于更改该设置的方法/文档: https : //docs.ghost.org/concepts/config/#admin-url

However — when using the above methodology the API Url that is used for Search etc etc is ALSO modified meaning all requests to the ghost API will also be forwarded to the alternate domain (not just the admin access). 但是-使用上述方法时,还对Search等使用的API Url进行了修改,这意味着对ghost API的所有请求也将转发到备用域(而不仅仅是管理员访问权限)。

My question is — what is the best way to achieve a redirect of the admin URL to a different Domain / protocol while allowing the API url used by Ghost to remain the same? 我的问题是-在允许Ghost使用的API网址保持不变的同时,实现将管理网址重定向到其他域/协议的最佳方法是什么?

More background. 更多背景。

We are running ghost on top of GKE (Google Kubernetes Engine) on a Multi-Region Ingress which allows us to dump our CloudSQL DB down to a SQLite file and then build that database into our production Docker Containers which are then deployed to the different Kubernetes nodes that are fronted by the GCE-Ingress load balancer. 我们在多区域入口的GKE(Google Kubernetes引擎)上运行了幽灵,这使我们能够将CloudSQL DB转储到SQLite文件,然后将该数据库构建到生产Docker容器中,然后将其部署到不同的Kubernetes GCE-Ingress负载平衡器所面向的节点。

Since we need to rebuild that database / container on content change (not just on code change) we need to have a separate Admin URL backed by Cloud SQL where we can persist / modify our data which then triggers the rebuild on our Ci pipeline via Ghost Webhooks. 由于我们需要根据内容更改(而不仅仅是代码更改)来重建数据库/容器,因此我们需要有一个由Cloud SQL支持的单独的Admin URL,我们可以在其中保留/修改数据,然后通过Ghost触发在Ci管道上的重建网络挂接。

Another related question might be: 另一个相关的问题可能是:

Is it possible to use standard ghost redirects (created via: https://docs.ghost.org/concepts/redirects/ ) to redirect the admin panel URL (ie. https://whateveryoursiteis.com/ghost ) to a different domain (ie. https://youradminsite.com/ghost )? 是否可以使用标准的虚幻重定向(通过https://docs.ghost.org/concepts/redirects/创建)将管理面板URL(即https://whateveryoursiteis.com/ghost )重定向到其他域(即https://youradminsite.com/ghost )?

Another Related GKE / GCE-Ingress Question: 另一个相关的GKE / GCE入口问题:

Is it possible to create 301 redirects natively using Kuberentes GCE-Ingress on GKE without adding an nGinx container etc? 是否可以在GKE上使用Kuberentes GCE-Ingress在本地创建301重定向,而无需添加nGinx容器等?

That will be my first attempt after posting this — but I figured either way maybe it helps another ghost platform fan down the line someplace — I will attempt to respond back as I find answers to those questions (assuming someone doesn't beat me to it!). 这将是我发布此内容后的第一次尝试-但我想了一下,也许这可以帮助某个幽灵平台的某个地方的粉丝-我会在找到这些问题的答案时做出回应(假设有人没有击败我) !)。

关于您的问题,是否可以在不添加nginx容器的情况下创建301重定向,我建议您使用istio, 在此处找到有关流量路由的更多信息。

OK. 好。 So as it turns out the Ghost team currently has things setup to point API connections at the Admin URL. 因此,事实证明,Ghost团队当前已进行了一些设置,以将API连接指向管理员URL。 So if you change your Admin URL expect your clients to attempt to connect to that URL. 因此,如果您更改管理URL,则希望您的客户端尝试连接到该URL。

I am going to be raising the potential of splitting these off as a feature request over on the ghost forums (as soon as I get out from under pre-launch hell on the current project). 我将提高在幽灵论坛上将这些内容作为功能请求进行拆分的潜力(一旦我从当前项目的预发布地狱中退出,就可以了)。

Here's the official Ghost response: 这是Ghost的官方回复:

What is referred as 'official docker image' is not something that we as a Ghost team support. 所谓的“官方docker映像”并不是我们作为Ghost团队支持的内容。

The APIs are indeed hosted under the same URL as the admin and that's by design and not really a bug. 这些API确实与管理员使用相同的URL托管,这是设计使然,并不是一个错误。 Introducing configuration options for each API Ghost instance hosts would be a feature and should be discussed at our forum first 👍 I think it's a nice idea to be able to serve APIs from different host, but it's not something that is within our priorities at the moment. 为每个API Ghost实例主机引入配置选项将是一项功能,应该在我们的论坛上首先进行讨论👍我认为能够从不同主机提供API是一个好主意,但这并不是我们当前优先考虑的事情。

In case you need more granular handling of admin site, you could introduce those on your proxy level and for example, handle requests that are coming to /ghost/api with a different set of rules. 如果您需要对管理站点进行更精细的处理,则可以在代理级别上引入这些请求,例如,使用一组不同的规则来处理/ ghost / api发出的请求。

See the full discussion over here on the TryGhost GitHub: https://github.com/TryGhost/Ghost/issues/10441#issuecomment-460378033 在TryGhost GitHub上查看此处的完整讨论: https : //github.com/TryGhost/Ghost/issues/10441#issuecomment-460378033

I haven't looked into what it would take to implement the feature but the suggestion on proxying the request could work... if only I didn't need to run on GKE Multi region (which requires use of GCE-Ingress which doesn't have support for redirection hah!). 我尚未研究实现该功能所需的时间,但是代理请求的建议可以起作用...如果仅不需要在GKE Multi区域上运行(这需要使用GCE-Ingress,则不会)不支持重定向哈!)。 This would be relatively easy to solve the nGinx ingress. 解决nGinx入口将相对容易。

Hopefully this helps someone — I will update as I work through the process. 希望这对某人有帮助-我将在整个过程中进行更新。 As of now I solved it by dumping my GCP CloudSQL database down to a SQLite db file during build time (thereby allowing me to keep my admin instance clean and separate from the API endpoint — which for me remains the same URL). 到目前为止,我已经通过在构建期间将GCP CloudSQL数据库转储到SQLite db文件中来解决了该问题(从而使我可以保持管理实例的清洁并与API端点分离(对于我而言,URL不变))。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 kubernetes 中的流量重新路由到工作 pod - Re-route traffic in kubernetes to a working pod 流量的重新路由不适用于入口 controller。 我觉得我误解了重写注释? - re-route of traffic is not working with ingress controller. I feel i mis-understood the re-write annotation? 如何在不修改 HTTP 客户端的情况下允许 API 访问 GKE K8S 集群 - How can I allow API access to a GKE K8S cluster without modifying the HTTP client 如何找到用于gitlab集成的gcloud Kubernetes api url - How do I find the gcloud Kubernetes api url for gitlab integration 如何在不全局公开端口的情况下将 RESTful localhost 调用从一个特定副本集路由/转发到另一个副本集? - How do I route/forward RESTful localhost calls from one specific replica set to another, without globally exposing a port? Azure Kubernetes Nginx Ingress: How do I properly route to an API service and an Nginx web server with HTTPS and avoid 502? - Azure Kubernetes Nginx Ingress: How do I properly route to an API service and an Nginx web server with HTTPS and avoid 502? 如何强制 Kubernetes 重新拉图像? - How do I force Kubernetes to re-pull an image? 如何在不修改副本的情况下升级 Helm 中的部署? - How to upgrade a Deployment in Helm without modifying replicas? Nginx 守护进程 - 我如何 select 绑定到哪个 IP 地址? - Nginx Daemonset - How do I select which IP address to bind to? 如何获取admin.conf文件? - How do I get the admin.conf file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM