This is the fifth day of my participation in the August Wen Challenge.More challenges in August

1. Common HTTP status codes

  1. 1 xx (informationStatus code)
    • 100:Continue, it is sentPOSTSend when requestedheaderAfter the message, the server returns this status code, indicating acknowledgement, and can continue sending data
  2. 2 xx (successfulStatus code)
    • 200:OK“Is returned normally
    • 201:Create, the request is successful and the servercreateA newresources
    • 202:AcceptedThe server accepted the request butHas yet to deal with
  3. 3 xx (redirect)
    • 301:Moved Permanently.Permanent redirection, the requested page has been permanently moved to the new location
    • 302:Found.Temporary redirection
    • 303:See Other.Temporary redirection, and always usedGETMethod requests a new URI
    • 304:Not Modified, since the last request,Page not modified
  4. 4 xx (The clientError)
    • 400:Bad Request, the server does not understand the request format
    • 401:UnauthorizedRequest,unauthorized
    • 403:Forbidden.banaccess
    • 404:Not Found.Can't findMatches the URIresources
  5. 5 xx (The service sideError)
    • 500:Internal Server Error, server error
    • 502:Bad GatewayThe server gateway is incorrect
    • 503:Service Unavailable, the server temporarilyUnable to process request

2.304 status code

If the client sends a conditional GET request and the request is granted, and the contents of the document have not changed (since the last access or according to the conditions of the request), the server should return the 304 status code (provided: there is a cache in the browser for comparison).

3.301 and 302

  • 301: indicates that the resource has been deletedA permanent moveTo a new location,A new locationIn the response returnedURI, the responseIn general, it can be cached
  • 302: Indicates that the resource isTemporary mobileThat should betemporaryFrom differentURIAccess the resource, the responseGenerally, it cannot be cached(Unless setExpiresorCache-Control)
  • Application:301Used to doPage jump.302Used to doTemporary jump(For example, unlogged users jump to the login interface)

4. Differences between GET and POST

In terms of GET POST
Parameter passing Stored in aURLIn the Stored in aRequest BodyIn the
Length limit There are length restrictions (mainlyBrowser Restrictions) Unlimited length
security Unsafe, exposed to the url Secure, request parameters are not visible in the url
encoding Only supportURLcoding supportA variety of codingway
The cache The browserTake the initiative toThe cache Can’t cache
Parameters reserved The browserkeepparameter The browserDon't keepparameter
back harmless The data will be resubmitted
idempotence Power etc. nonidempotence
Side effects There is noSide effects There areSide effects
application The query Commit changes

There is also a controversial claim: A POST request produces two packets while a GET request produces only one. In fact, a POST request produces two packets as a result of sending the header and body separately. This is not necessary

5. Fetch sends two requests

The fetch sends a POST request twice. The first sends an Options request asking the server if it supports the modified headers. If so, the second sends the data.

6.CDN

CDN: Content Delivery Network

  • Try to avoid the Internet as much as possibleBe likely to influencedataTransmission speedandThe stability ofThe bottleneck and link, so that content transmission faster, more stable.
  • Method: MultipleCDNNode server pairThe source stationResources forThe cachePass all when the user accessesLocal load technologyPoint user access toTo the nearestThe node ofCDN nodetoThe responseUser request
  • Purpose: To get usersTo the nearestAccess to resources to speed up usersAccess speed
  • Advantages:
    • To solveAcross the regionandCross operatorAccess problems,To reduceaccessTime delay
    • Stand up to the sourceshuntRole,To reduceThe source stationload

7.DNS

Domain Name System (DNS)

DNS concepts:

  • byLayered DNS serverImplementation of theDistributed database
  • One that allows the host toThe queryDistributed databaseApplication layer protocol

Description:

  • For browsers,DNSIs used to bringThe domain nameConverted toThe IP addressthe
  • Query method:recursiveQuery +The iterationThe query
  • recursiveQuery:This machinetoLocal DNS ServerPerform a query and return the query result
  • The iterationQuery:Local DNS ServerContinue toThe root,TLD(Top-level domain),authorityEtc.The DNS serverQuery domain names and obtain the query result