Strange behavior with absolute URLs

I just attempted {{url absolute="true"}} in my theme and it gave me a complete URL http://localhost:2368/my-post/. When I attempt {{url absolute="false"}}, it still spits out the complete URL; However, when I use {{url relative="true"}}, it uses a relative URL path /my-post/. Is this normal behavior?

Would be nice if Ghost supported protocol-relative URL schemas //localhost:2368/my-post/ . I am currently having an issue deploying ghost behind a load-balancer that listens on HTTPS and fetches requests from containers on HTTP. This causes an issue where, if I set config.url to https://, and the load balancer is doing health-checks against http://, it gives a 301 redirect, and thus, a failed response. 301 redirects are then cached and when I update a post, I get DNS cached results back from load balancer.

I am going with {{url relative="true"}} since it removes the config.url part for now, but reporting this because it seems like a common thing.

a nice work around would be to add a /api/health-check endpoint to ghost that does not redirect to https, and does not require authentication.

{{url absolute=true}}
{{url absolute=false}}

You have to use a boolean and not a string :slight_smile:

@Kate this is a change in behaviour, it was always a string: Ghost Handlebars Theme Helpers: url

1 Like

Hm weird. Will look into :+1:

I just tested 0.x and 1.x.

{{url absolute=“false”}}

A string never worked.

I assume the docs are incorrect or we want to add the functionality.

What’s strange is that, documentation suggests relative is default. I was getting absolute URLs as default, and only when I use relative=“true” did it become relative. I followed the rabbit in the code and got to this Doesn’t seem to reference relative argument anywhere.


We have released 2.16.3.

It contains a fix which makes it possible to use {{url absolute="false"}}.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.