Skip to content

RFC allow client to specify embedded content URI scheme #28

@mandrews

Description

@mandrews

Problem

Some oEmbed providers respond with HTTPS embeded content only when the oEmbed API endpoint is requested over HTTPS. For example, Vimeo:
embeded content over http vs. embeded content over https.
When presenting site content and embeded content together, it's important to use the the same protocol (either HTTP or HTTPS) otherwise mixed content warnings occur in most browsers.
At the moment, ruby-oembed associates a URL with an oEmbed API provider endpoint but does not allow the client application to specify the embeded content URI scheme.

Potential Solution

Register OEmbed::Provider with a :scheme flag and optionally pass a flag to OEmbed::Providers#find and OEmbed::Providers#get, e.g:

vimeo_ssl = OEmbed::Provider.new("https://vimeo.com/api/oembed.{format}") 
vimeo_ssl << "http://*.vimeo.com/*"  
vimeo_ssl << "https://*.vimeo.com/*"
OEmbed::Providers.register(vimeo_ssl, :scheme => 'https')
OEmbed::Providers.find('http://vimeo.com/17472698', :scheme => 'https')
OEmbed::Providers.get('http://vimeo.com/17472698', :scheme => 'https')

when scheme is omitted, the default provider (e.g. provider registered without scheme) should be selected. It should be possible to extend the library with this functionality without breaking backwards compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions