2017-05-29 5 views
0

は、次のように オートデスクビューアダブル圧縮ストリーム私はエラーを受信して​​いオートデスクビューアを使用して

An LMV resource ([redacted]/1/objects_attrs.json.gz) was not uncompressed by the browser. This hurts performance. Check the Content-Encoding header returned by the server and check whether you're getting double-compressed streams. The warning prints only once but it's likely the problem affects multiple resources.

マイレスポンスヘッダ

です?このエラーがコンソールに記録されている場合、ビューアはブラウザではなくファイルを解凍していますか?

答えて

1

はいこの警告が表示された場合、ビューアは圧縮解除を処理していますが、これはパフォーマンス上望ましくありません。

は、あなたのビューアのリソースを提供するためにプロキシを使用してについての私の記事を見てみることができます:Securing your Forge Viewer token behind a proxy

これはgzip圧縮されたリソース(Node.jsのコード)のための正しいコンテンツ・エンコーディングを設定します。

function fixContentHeaders (req, res) { 

    // DS does not return content-encoding header 
    // for gzip and other files that we know are gzipped, 
    // so we add it here. The viewer does want 
    // gzip files uncompressed by the browser 
    if (EXTENSIONS.gzip.indexOf (path.extname (req.path)) > -1) { 
    res.set ('content-encoding', 'gzip') 
    } 

    if (EXTENSIONS.json.indexOf (path.extname (req.path)) > -1){ 
    res.set ('content-type', 'application/json') 
    } 
} 

これにより、派生サービスから直接ファイルを提供することができます。

//This API available from v 2.14 
Autodesk.Viewing.setEndpointAndApi( 
    window.location.origin + '/lmv-proxy', 
'modelDerivativeV2') 
関連する問題