Closed Bellfalasch closed 8 months ago
Hi Bobby!
Question, are you generating your responses based on "live requests" i.e. someone requests www.domain.com -> lotsofstuff -> k8s - and then when you request generation of an absolute URL, and in the response, you get "k8s.obscure.stuff/path/to/item"?
The solution to this problem is to enable host forwarding in your infrastructure. This is a fairly standard proxy/loadbalancer/webserver setup. Basically, the proxies should either forward the host header, or set x-forwarded-host: www.domain.com. Then XP will generate the correct URLs for you. NB! Same goes for protocol, so XP will generate https rather than http in the absolute urls.
In apache for instance, this is enabled adding this line to a vhost: ProxyPreserveHost On
The protocol is forwarded as x-forwarded-proto
if i remember correctly
In
Sitemap.xml
version 1.5.0 you landed a tiny but brilliant feature: "support custom domain". Could this also be added to this app, SEO Metafields?The problem is today we run all apps in Kubernetes and Azure, and each app running are served from a very long and obscure domain. Using any portal or content function will generate a
xxx-apps-int.io
-like URL even if the domain we visit the page on isgjensidige.no
. So all apps usingtype:absolute
will give the "wrong" URL, and we cannot control this. So what we do for sitemap and SEO output is we hack this to fix it: we run filters on the generated html response, and replace allxxx-apps-int.io
with the correct URL. Before sitemap.xml 1.5 we had two filters for this in total, running on all our requests, so with 1.5 we can now remove one of them. If this domain-feature also landed in the SEO app we could remove the last filter!As far as I recall, only canonical URL output, and one of the
og:
outputs useabsolute
astype
and those are affected here.