Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concurrent http2 requests return the same response for all requests #52

Closed
tripodsan opened this issue Jun 11, 2020 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@tripodsan
Copy link
Contributor

tripodsan commented Jun 11, 2020

Description
when issuing several requests at once, they all return the same response, if the hostname resolves to the same IP.

  • switching to http1 solves the problem
  • adding an explicit host header solves the problem.

To Reproduce
run the following:

const { fetch } = require('@adobe/helix-fetch').context({
  // httpProtocol: 'http1',
  // httpsProtocols: ['http1'],
});
const crypto = require('crypto');

async function request(url) {
  console.log('requesting', url)
  const res = await fetch(url, {
    // headers: {
    //   host: new URL(url).hostname,
    // },
    cache: 'no-store',
  });
  const data = await res.text();
  const md5 = crypto.createHash('md5').update(data).digest().toString('hex');
  console.log('result', url, 'md5=', md5, res.headers.raw());
}

async function run() {
  await Promise.all([
    request('https://lr-landing-davidnuescheler.project-helix.page/'),
    request('https://n2-davidnuescheler.hlx.page/index.html'),
    request('https://theblog--adobe.hlx.page/index.html'),
  ]);
}

run().catch(console.error);

result:

$ node index.js
requesting https://lr-landing-davidnuescheler.project-helix.page/
requesting https://n2-davidnuescheler.hlx.page/index.html
requesting https://theblog--adobe.hlx.page/index.html
result https://theblog--adobe.hlx.page/index.html md5= 22971378ba99ace7ba88e6474e7e0c04 { 'cache-control': 'max-age=604800, must-revalidate, private',
  'content-type': 'text/html; charset=UTF-8',
  link:
   '<https://lr-landing-davidnuescheler.project-helix.page/index.html>; rel="canonical"',
  date: 'Thu, 11 Jun 2020 05:18:39 GMT',
  age: '0',
  vary: 'X-Debug,X-Strain,X-Request-Type',
  'strict-transport-security': 'max-age=31536000',
  'x-version': '332; src=332; cli=5.8.2; rev=online' }
result https://n2-davidnuescheler.hlx.page/index.html md5= 22971378ba99ace7ba88e6474e7e0c04 { 'cache-control': 'max-age=604800, must-revalidate, private',
  'content-type': 'text/html; charset=UTF-8',
  link:
   '<https://lr-landing-davidnuescheler.project-helix.page/index.html>; rel="canonical"',
  date: 'Thu, 11 Jun 2020 05:18:39 GMT',
  age: '0',
  vary: 'X-Debug,X-Strain,X-Request-Type',
  'strict-transport-security': 'max-age=31536000',
  'x-version': '332; src=332; cli=5.8.2; rev=online' }
result https://lr-landing-davidnuescheler.project-helix.page/ md5= 22971378ba99ace7ba88e6474e7e0c04 { 'cache-control': 'max-age=604800, must-revalidate, private',
  'content-type': 'text/html; charset=UTF-8',
  link:
   '<https://lr-landing-davidnuescheler.project-helix.page/index.html>; rel="canonical"',
  date: 'Thu, 11 Jun 2020 05:18:39 GMT',
  age: '0',
  vary: 'X-Debug,X-Strain,X-Request-Type',
  'strict-transport-security': 'max-age=31536000',
  'x-version': '332; src=332; cli=5.8.2; rev=online' }
@tripodsan tripodsan added the bug Something isn't working label Jun 11, 2020
@stefan-guggisberg stefan-guggisberg self-assigned this Jun 11, 2020
@stefan-guggisberg
Copy link
Contributor

See fetch-h2 issue.

stefan-guggisberg added a commit that referenced this issue Jun 15, 2020
trieloff pushed a commit that referenced this issue Jun 15, 2020
## [1.6.2](v1.6.1...v1.6.2) (2020-06-15)

### Bug Fixes

* explicitly set Host header ([331fcc9](331fcc9)), closes [#52](#52)
@stefan-guggisberg
Copy link
Contributor

stefan-guggisberg commented Jun 15, 2020

implemented workaround in 331fcc9

will remove workaround once/if the underlying fetch-h2 issue gets fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants