client/nginx: meta tags use X-Forwarded-Proto
This commit is contained in:
parent
d5fda346d2
commit
372b40a6b5
2 changed files with 8 additions and 1 deletions
|
@ -79,6 +79,9 @@ elseif ngx.var.request_uri_path:match('^/post/([0-9]+)/?$') then -- Post metadat
|
||||||
add_meta_tag("twitter:image", ngx.var.external_host_url .. '/' .. post_info.contentUrl)
|
add_meta_tag("twitter:image", ngx.var.external_host_url .. '/' .. post_info.contentUrl)
|
||||||
elseif post_info.type == "video" then
|
elseif post_info.type == "video" then
|
||||||
og_media_prefix = "og:video"
|
og_media_prefix = "og:video"
|
||||||
|
add_meta_tag("twitter:card", "player")
|
||||||
|
add_meta_tag("twitter:player:width", post_info.canvasWidth)
|
||||||
|
add_meta_tag("twitter:player:height", post_info.canvasHeight)
|
||||||
-- some sites don't preview video, so at least provide a thumbnail
|
-- some sites don't preview video, so at least provide a thumbnail
|
||||||
add_meta_tag("og:image", ngx.var.external_host_url .. '/' .. post_info.thumbnailUrl)
|
add_meta_tag("og:image", ngx.var.external_host_url .. '/' .. post_info.thumbnailUrl)
|
||||||
end
|
end
|
||||||
|
|
|
@ -110,8 +110,12 @@ http {
|
||||||
|
|
||||||
location /_meta_tags_html {
|
location /_meta_tags_html {
|
||||||
internal;
|
internal;
|
||||||
|
set $original_scheme $scheme;
|
||||||
|
if ( $http_x_forwarded_proto = 'https' ) {
|
||||||
|
set $original_scheme "https";
|
||||||
|
}
|
||||||
root /var/www;
|
root /var/www;
|
||||||
set $external_host_url "${scheme}://${http_host}";
|
set $external_host_url "${original_scheme}://${http_host}";
|
||||||
content_by_lua_file /etc/nginx/metatags.lua;
|
content_by_lua_file /etc/nginx/metatags.lua;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue