How to solve Fastly error: unknown domain - Super User

文章推薦指數: 80 %
投票人數:10人

HTTP requests always include a "Host:" header indicating what name was actually used in the URL. For example, accessing http://superuser.com ... SuperUserisaquestionandanswersiteforcomputerenthusiastsandpowerusers.Itonlytakesaminutetosignup. Signuptojointhiscommunity Anybodycanaskaquestion Anybodycananswer Thebestanswersarevotedupandrisetothetop Home Public Questions Tags Users Companies Unanswered Teams StackOverflowforTeams –Startcollaboratingandsharingorganizationalknowledge. CreateafreeTeam WhyTeams? Teams CreatefreeTeam Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. Learnmore HowtosolveFastlyerror:unknowndomain AskQuestion Asked 3years,2monthsago Modified 3years,2monthsago Viewed 25ktimes 4 I'mtryingtoaccomplishthistask,IhaveanIPandwiththeIPIwanttomakeanHTTPrequest. Let'ssaythatIhavethestackoverflow.comIP(151.101.193.69)andIwanttomakeanHTTPrequestatthewebsitewithpythonusingtherequestsmodule.Iwrtiethiscode importrequests response=requests.get("http://151.101.193.69:80") response.text thatreturnsthehtmlcodeofthepage. DoingsoIgetapagethatsays Fastlyerror:unknowndomain:151.101.193.69.Pleasecheckthatthisdomainhasbeenaddedtoaservice. Details:cache-mxp19846-MXP ButifIdothiswiththeGoogleIPitworksandtherequestreturnstheGooglehomepage importrequests response=requests.get("http://216.58.205.174:80") response.text networkingdnspython Share Improvethisquestion Follow editedMay19,2019at12:46 Mat.C askedMay19,2019at12:10 Mat.CMat.C 15111goldbadge11silverbadge55bronzebadges 2 Trythisinyourbrowser151.101.193.69:80TheresultyouaregettinginpythonisthesameasinthebrowserSothisisnotapythonissue,andnotaquestionofhowtomakeanHTTPrequest.TheHTTPrequestisfine.There'ssomeissueattheserverend – barlop May19,2019at12:21 AndthequestioniscompletelywrongbecauseyouknowverywellhowtomakearequesttoanIPsinceyoumanageditforgoogle'sIP:PORT – barlop May19,2019at12:22 Addacomment  |  1Answer 1 Sortedby: Resettodefault Highestscore(default) Datemodified(newestfirst) Datecreated(oldestfirst) 9 Yes,that'snormal. HTTPrequestsalwaysincludea"Host:"headerindicatingwhatnamewasactuallyusedintheURL.Forexample,accessinghttp://superuser.comwillsendaheaderHost:superuser.com;andifyou'reusinghttp://151.101.193.69,theheaderwillofcourseshowHost:151.101.193.69(orevenbecompletelyabsent). TheimportantbitisthatmanyHTTPserverssharethesameIPaddressformanydifferentdomains(akavirtualhosting),andtheyrelyonthisheadertoknowwhichdomainyou'retryingtoaccess. Forexample,allStackExchangedomains–superuser.com,stackoverflow.com,serverfault.com,diy.stackexchange.com,…–sharetheexactsamesetofIPaddresses.Theonlywayforthewebservertodistinguishbetweenallthesewebsitesisbylookingatthe"Host"HTTPheader. (Additionally,theseaddressesactuallybelongtoFastlyCDN,nottotherealwebservers.LargeCDNssuchasFastlyorCloudFlaremightusethesameIPaddressforhundredsofdomainsfromvariousdifferentcustomers.) Finally,itisuptotheservertodecidewhatit'lldowith"Host"headersthatitdoesn'trecognize.Someserversreturnanerrorpagestatingso,otherserversreturnthe"first"domainthattheyhave. Soinordertomakeasuccessfulrequest,you'dneedtodothis: requests.get("http://151.101.193.69",headers={"Host":"stackoverflow.com"}) Butthat'sasillywayofsayingrequests.get("http://stackoverflow.com").TheonlytimeyoumightneedthismethodiswhenyouhaveanIPaddressthatdoesn'tmatchtheDNSinformation(e.g.ifyou'retryingtobypassDNS). (AnditwillcauseyoumoreproblemsassoonasyoutrytoaccessaHTTPSwebsite,becausethedomainfromtheURLisusedforcheckingTLScertificates,too.) Share Improvethisanswer Follow editedMay19,2019at12:55 answeredMay19,2019at12:25 user1686user1686 379k5858goldbadges788788silverbadges865865bronzebadges 2 andifiknowonlytheipwithoutknowingthehost? – Mat.C May19,2019at12:46 Thenyouusuallycannotaccessthewebsite,andhopefullythepostexplainswhyyoucannot.(Itmightworkwithdedicatedwebserverswhichliterallyhavejustthatonewebsite,butitusuallywon'tworkwithwebserverswhichhavemultiple.) – user1686 May19,2019at12:48 Addacomment  |  YourAnswer ThanksforcontributingananswertoSuperUser!Pleasebesuretoanswerthequestion.Providedetailsandshareyourresearch!Butavoid…Askingforhelp,clarification,orrespondingtootheranswers.Makingstatementsbasedonopinion;backthemupwithreferencesorpersonalexperience.Tolearnmore,seeourtipsonwritinggreatanswers. Draftsaved Draftdiscarded Signuporlogin SignupusingGoogle SignupusingFacebook SignupusingEmailandPassword Submit Postasaguest Name Email Required,butnevershown PostYourAnswer Discard Byclicking“PostYourAnswer”,youagreetoourtermsofservice,privacypolicyandcookiepolicy Nottheansweryou'relookingfor?Browseotherquestionstaggednetworkingdnspythonoraskyourownquestion. TheOverflowBlog MonitoringdataqualitywithBigeye (Ep.469) FeaturedonMeta AnnouncingtheStacksEditorBetarelease! Linked 13 HowtosendanHTTPrequestforacertaindomainnametoaspecificIPaddress? Related 2 Monitornetworkconnection,autoresponse 0 DomainnameversusIPaddressinconjunctionwithSSLandcustomappport HotNetworkQuestions DoesthisJavaScriptexamplecreate“raceconditions”?(TotheextentthattheycanexistinJavaScript) Animatedshowwhereaslaveboytriestoescapeandisthentoldtofindarobotfugitive CanYouHelpIdentifyThisTool?AssumingIt's1800s! WhyDoesn'ttheDiamondArrowinthisTikzCodeExampleWork? Whatisthemusictheoryrelatedtoabassprogressionofdescendingaugmented4thfrom^7to^4? At3%inflationrateis$100todayworth$4020yearsago Whyisa220ΩresistorforthisLEDsuggestedifOhm'slawseemstosaymuchlessisrequired? Isanyonewithaccumulatedwealthsaved? IsittruethatsizesofsomecountriesareshownsmalleronMapsthantheyactuallyare? HowdoIpolitelyrefuse/cut-offapersonwhoneedsmeonlywhentheywantsomething? WhatratingpointadvantagedoesplayingWhiteequateto? ExternalharddrivenotworkingafterunpluggingwhileWindowsExplorerwasn'tresponding Whatisthegravitationalforceactingonamasslessbody? Mysterytelephoneconnectionblockinoldcottage ShouldItellmybossthatIamdoingacrazyamountofovertime? Oscillatinginstrumentationamplifierwithtransformercoupledinput Transformcharactersofyourchoiceinto"Hello,world!" ELI5:WhyisRussia'srequirementforoiltobepaidinRoublesabnormal? TheExpanse:SustainedGsduringspacetravel Howtopreventstressonthejobfromaffectingmywell-being Whyfixies(singlespeedbicycles)haveonebrakeonthefront? Derivativesnearoptimalpoints Whatisthebestwaytostorepotatoes? RepeatHelloWorldaccordingtoanotherstring'slength morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings  



請為這篇文章評分?