24982

Is http keep-alive effective with different domain on the same webserver?

Question:

On the same nginx/apache server:

<ul><li>Scene 1: a.test.com and b.test.com can use keep-alive?</li> <li>Scene 2: localhost and 127.0.0.1 can use keep-alive?</li> </ul>

or the "Host header" must be consistent and the keep-alive will effective?

Answer1:

For Apache it looks like it's based on IP address rather than host header, though I guess it also very much depends on client implementation.

<a href="https://httpd.apache.org/docs/2.4/vhosts/details.html#hostmatching" rel="nofollow">https://httpd.apache.org/docs/2.4/vhosts/details.html#hostmatching</a>

<blockquote>

<strong>Persistent connections</strong>

The IP lookup described above is only done once for a particular TCP/IP session while the name lookup is done on every request during a KeepAlive/persistent connection. In other words, a client may request pages from different name-based vhosts during a single persistent connection.

</blockquote>

Unless you are using tens of hundreds of domains I'd say you'd struggle to notice either way though it should be easy enough to test using developer tools or webpagetest.org to see if time is spent negotiating a new connection.

Recommend

  • Google cloud datastore emulator init data
  • Google OAuth2 for an web application hosted behind NAT (intranet server without public IP)
  • How to package a jar and all dependencies within a new jar with maven
  • PHP in userdir not working
  • VB.Net Double comparison after some additions
  • Android NFC read Tags issue. Activity starts each time on data received
  • openssl handshake failed
  • How to resolve docker host names (/etc/hosts) in containers
  • Should I be afraid to use UDP to make a client/server broadcast talk?
  • How do you keep a running instance for Google App Engine
  • netsh acl setting (need alternative method - registry settings?)
  • how to set variables in a php include file?
  • Thread 1: EXC_BAD_ACCESS (code =1 address = 0x0)
  • Sonar maven jacoco code coverage for Multimodule project
  • Spring Cloud Microservice Architecture Confusion
  • Zurb Foundation _global.scss meta styles for js?
  • OOP Javascript - Is “get property” method necessary?
  • Transactional Create with Validation in ServiceStack Redis Client
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • Use of this Javascript
  • Meteor: Do Something On Email Verification Confirmation
  • C++ Partial template specialization - design simplification
  • Cannot resolve symbol 'MyApi'
  • ImageMagick, replace semi-transparent white with opaque white
  • Handling un-mapped Rest path
  • Recording logins for password protected directories
  • How to get address from latitude and longitude android google map v2 [duplicate]
  • Cannot connect to cassandra from Spark
  • Illegal mix of collations for operation for date/time comparison
  • PHP - How to update data to MySQL when click a radio button
  • Cross-Platform Protobuf Serialization
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • How to get next/previous record number?
  • QuartzCore.framework for Mono Develop
  • RestKit - RKRequestDelegate does not exist
  • Python: how to group similar lists together in a list of lists?
  • using HTMLImports.whenReady not working in chrome
  • How do you join a server to an Active Directory (domain)?
  • Exception on Android 4.0 `android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode)`
  • need help with bizarre java.net.HttpURLConnection behavior