What does the HTTP 206 Partial Content status message mean and how do I fully load resources?

后端 未结 4 1029
不思量自难忘°
不思量自难忘° 2020-12-02 16:40

I have some image tags on a site like this.


When I try to load them they are only half loading. When I checked

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 17:35

    Firstly:

    The HTTP 206 Partial Content success status response code indicates that the request has succeeded and has the body contains the requested ranges of data, as described in the Range header of the request.

    If there is only one range, the Content-Type of the whole response is set to the type of the document, and a Content-Range is provided.

    If several ranges are sent back, the Content-Type is set to multipart/byteranges and each fragment covers one range, with Content-Range and Content-Type describing it.

    (From Mozilla's excellent HTTP status code reference.)

    Next:

    HTTP headers set on resources are usually set by the web server. However if the file is large, like a video file the browser can request a chunk of the resource that is being loaded. Usually a HTTP 206 header will be returned from a client initiated request. The headers set on resources in apache are set in the mod_headers section of the httpd.conf. Look for the following line to see if partial content is turned on:

    Header set Accept-Ranges bytes
    

    This section controls the behavior of headers set by apache so it will be a good place to start.

    Setting the headers can however be done in a number of different ways. For example when using apache you can control the images that are loaded so that they will cache. This can be done using the [a2enmod module][2]. This will reduce the load on your server.

提交回复
热议问题