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

ActivityPub対応準備 #296

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ const handle = app.getRequestHandler();
// Next.js を localhost:3000 で起動
app.prepare().then(() => {
const server = express();

// .well-known/*へのリクエストをプロキシする
server.use(
'/.well-known/*',
createProxyMiddleware({
target: 'http://localhost:8080',
changeOrigin: true,
}),
);

server.all('*', (req, res) => {
return handle(req, res);
});
Expand Down
23 changes: 23 additions & 0 deletions sst.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { SSTConfig } from 'sst';
import { NextjsSite } from 'sst/constructs';
import { HttpOrigin } from 'aws-cdk-lib/aws-cloudfront-origins';
import {
AllowedMethods,
CachePolicy,
OriginProtocolPolicy,
OriginRequestPolicy,
ViewerProtocolPolicy,
} from 'aws-cdk-lib/aws-cloudfront';

export default {
config(_input) {
Expand Down Expand Up @@ -28,6 +36,21 @@ export default {
warm: 100,
memorySize: '2048 MB',
logging: 'combined',
cdk: {
distribution: {
additionalBehaviors: {
'.well-known/*': {
origin: new HttpOrigin(`api.${domain}`, {
protocolPolicy: OriginProtocolPolicy.MATCH_VIEWER,
}),
viewerProtocolPolicy: ViewerProtocolPolicy.ALLOW_ALL,
allowedMethods: AllowedMethods.ALLOW_ALL,
cachePolicy: CachePolicy.CACHING_DISABLED,
originRequestPolicy: OriginRequestPolicy.ALL_VIEWER,
},
},
},
},
});

stack.addOutputs({
Expand Down
Loading