{"record":{"id":"33d9b33b888d400d","repo":"angular/angular-cli","slug":"warning-deploy-url-and-or-base-href-contain-u","errorCode":null,"errorMessage":"Warning: --deploy-url and/or --base-href contain unsupported values for ng serve. Default serve path of '/' used. Use --serve-path to override.","messagePattern":"Warning: --deploy-url and/or --base-href contain unsupported values for ng serve\\. Default serve path of '/' used\\. Use --serve-path to override\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/angular_devkit/build_angular/src/tools/webpack/configs/dev-server.ts","lineNumber":107,"sourceCode":"      proxy: await addProxyConfig(root, proxyConfig),\n      ...getWebSocketSettings(wco.buildOptions, servePath),\n    },\n  };\n}\n\n/**\n * Resolve and build a URL _path_ that will be the root of the server. This resolved base href and\n * deploy URL from the browser options and returns a path from the root.\n */\nexport function buildServePath(\n  options: WebpackDevServerOptions,\n  logger: logging.LoggerApi,\n): string {\n  let servePath = options.servePath;\n  if (servePath === undefined) {\n    const defaultPath = findDefaultServePath(options.baseHref, options.deployUrl);\n    if (defaultPath == null) {\n      logger.warn(tags.oneLine`\n        Warning: --deploy-url and/or --base-href contain unsupported values for ng serve. Default\n        serve path of '/' used. Use --serve-path to override.\n      `);\n    }\n    servePath = defaultPath || '';\n  }\n\n  if (servePath.endsWith('/')) {\n    servePath = servePath.slice(0, -1);\n  }\n\n  if (!servePath.startsWith('/')) {\n    servePath = `/${servePath}`;\n  }\n\n  return servePath;\n}\n","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/tools/webpack/configs/dev-server.ts#L89-L125","documentation":"In the dev-server webpack config, when no explicit servePath is given, findDefaultServePath computes one from baseHref/deployUrl. If those values are incompatible/unsupported (null result), the builder falls back to serving at '/' and logs this warning.","triggerScenarios":"Running `ng serve` with --deploy-url and/or --base-href values that cannot be combined into a valid default serve path, and no --serve-path supplied.","commonSituations":"Using absolute deploy URLs (e.g., https://cdn.example.com/app/) or unusual base-href with ng serve; assets seem served at wrong path.","solutions":["Pass an explicit --serve-path (or servePath option in angular.json) to define the served path.","Remove or simplify --deploy-url/--base-href during local serving; keep them only for production builds.","If a custom path is needed, set servePath explicitly instead of relying on the automatic derivation."],"exampleFix":"// before\nng serve --base-href /app/ --deploy-url https://cdn.example.com/app/\n// after\nng serve --serve-path /app/","handlingStrategy":"validation","validationCode":"// Validate deploy-url/base-href before serving:\nfunction validServePath(baseHref, deployUrl, servePath) {\n  if (servePath) return true;\n  if (deployUrl && /^https?:\\/\\//.test(deployUrl)) return false;\n  if (baseHref && !/^(\\/[^*]*)?$/.test(baseHref)) return false;\n  return true;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an explicit --serve-path when using non-default base-href/deploy-url in dev.","Reserve --deploy-url for production builds, not `ng serve`.","Check that served asset URLs match expectations after serve configuration changes."],"tags":["angular","dev-server","serve-path","configuration"],"backgroundTag":"invalid-serve-path","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}