2017-05-24 19 views
2

这是一个由两部分组成的问题。通过https嵌入的Soundcloud和一些资源响应403

FIRST: 我们在嵌入soundcloud资源时遇到问题,我们的网站使用https。 当加载嵌入资源,它使一个请求(例如URL:http://soundcloud.com/oembed?format=js&url=https://soundcloud.com/user908553597%2Fann-marie-in-my-feelings-treat-me-like-somebody-remake&iframe=true),它被适当地与此响应:

({ 
    "version":1.0, 
    "type":"rich", 
    "provider_name":"SoundCloud", 
    "provider_url":"http://soundcloud.com", 
    "height":400,"width":"100%", 
    "title":"Ann Marie - In My Feelings (Treat Me Like Somebody Remake) by user908553597", 
    "description":"", 
    "thumbnail_url":"http://i1.sndcdn.com/artworks-000146535766-ycam16-t500x500.jpg", 
    "html":"\u003Ciframe width=\"100%\" height=\"400\" scrolling=\"no\" frameborder=\"no\" src=\"https://w.soundcloud.com/player/?visual=true\u0026url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F246270367\u0026show_artwork=true\"\u003E\u003C/iframe\u003E", 
    "author_name":"user908553597", 
    "author_url":"http://soundcloud.com/user908553597" 
}); 

然而,“PROVIDER_URL”和“thumbnail_url”被返回以http协议,作为我们的网站通过https运行会导致问题。 是否可以使用标志或参数来确保响应中的所有资源使用https,还是需要更改API?

第二: 一些资源似乎返回一个HTTP 403响应代码,例如:http://soundcloud.com/oembed?format=js&url=https://soundcloud.com/richgurl_1%2Ftink-treat-me-like-somebody&iframe=true是这个API应该如何处理某些资源的请求?即这是一种可预测的行为,所以人们可以对返回的403进行操作。

预先感谢

回答

1

所以我理解了它, 或至少一个解决方案,是可管理。改变协议做了它 例如URL:https://soundcloud.com/oembed?format=js&url=https://soundcloud.com/user908553597%2Fann-marie-in-my-feelings-treat-me-like-somebody-remake&iframe=true

的thumbnail_url经由HTTP retutrned,我的解决办法是通过在角的.TS文件花费上面的URL的响应,使用替换以改变协议为https。然后使用thumbnail_url的iframe具有所需协议的url。