![](/img/trans.png)
[英]Using aws s3 and cloudfront to host React application.Can anyone suggest configuration to access dynamic urls?
[英]AWS-S3 and AWS-CloudFront With React routes, multi application
我有以下情况。
例如:
S3 目录
|--/
|--/first-app/
|--/second-app/
first-app
的反应路线
const routes = [
{
path: '/',
component: Empty,
exact: true,
},
{
path: '/first-app',
component: Layout,
routes: [
{ path: '/first-app/create', component: CreateCommponent},
{ path: '/first-app/login', component: Login },
{ path: '/first-app/logout', component: Logout },
],
},
]
反应second-app
的路线
const routes = [
{
path: '/',
component: Empty,
exact: true,
},
{
path: '/second-app',
component: Layout,
routes: [
{ path: '/second-app/create', component: OtherComponent},
{ path: '/second-app/login', component: Login },
{ path: '/second-app/logout', component: Logout },
],
},
]
如何使 cloudFront 在每个目录中独立但在同一个域下为每个应用程序提供服务?
https://my.domain.com/first-app
>> 服务于 react 应用程序中间 index.html of first-app
https://my.domain.com/second-app
>> 服务react应用中间index.html of second-app
您可以使用 Lambda@Edge 执行此操作,以便在将请求发送到存储桶之前操纵请求参数。 这是一个类似的例子: 这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.