web icon indicating copy to clipboard operation
web copied to clipboard

[dev-server] Issue with 404 error when enabling HTTP/2 in local web-dev-server config

Open marcsalvatierra opened this issue 2 years ago • 0 comments

I'm currently encountering an issue while running my app shell locally. When it attempt to fetch files from the appIndex, I consistently receive a 404 Not Found error on the scripts in my index_dev.html. This issue only arises when I enable HTTP/2 by setting it to true in my WDS config. When I use HTTP instead of HTTPS, everything renders correctly.

Below, I've included a snippet of my WDS config for your reference:

import { ApiProxyKoaMiddleware } from '@ing-web-tools/api-proxy';
import MockServer from 'ing-kit-mock-server';

const basePath = new URL('./', import.meta.url).pathname;
const server = new MockServer(9010, basePath, {
  https: true,
  local: true,
  keyPath: './demo/server/server.key',
  certPath: './demo/server/server.crt',
});

server.startServer();

export default {
  http2: true,
  sslKey: './demo/server/server.key',
  sslCert: './demo/server/server.crt',
  open: '/templates/',
  watch: true,
  nodeResolve: true,
  appIndex: 'templates/index_dev.html',
  port: 9000,
  preserveSymlinks: true,
  middleware: [
    (context, next) => {
      context.request.header.host = 'localhost:9000';

      return next();
    },
    ApiProxyKoaMiddleware({
      proxyDomain: 'localhost:9010',
      redirectPaths: [/^\/api\//],
    }),
  ],
};

marcsalvatierra avatar Sep 26 '23 13:09 marcsalvatierra