export const routes: Routes = [
{ path: 'foo.bar', component: ListComponent },
{ path: 'foobar', component: ListComponent },
example.com/foobar
工作正常,example.com/foo.bar
返回404
它在生产环境中运行良好,但仅在使用ng serve
时出现在本地开发页面上.这使得调试特定的url参数对我来说有点挑战性.
关于这个404错误,即使我试图访问的页面没有配置在routes
中,它也应该重定向到默认的**
或/
目的地,而不是直接转到404.
curl -i http://127.0.0.1:4200/foo.bar
HTTP/1.1 404 Not Found
Access-Control-Allow-Origin: *
Date: Thu, 11 Jan 2024 02:52:11 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 0
curl -i http://127.0.0.1:4200/foobar
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: text/html
Cache-Control: no-cache
Date: Thu, 11 Jan 2024 02:52:13 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 891
<!doctype html>
<html lang="en">
<head>
<script type="module" src="/openai/@vite/client"></script>
...