0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

コンテナ(フロントエンド、バックエンド)間での通信設定

Posted at

フロントエンド(Next.js)のコンテナからバックエンド(例えば、djangoのapi) のコンテナへAPI通信を行う際は、フロントエンド側のnext.config.mjsにて、docker.internalの設定を行う。

next.config.mjs
const nextConfig = {};
export default {
    async rewrites() {
        return [
            {
                source: '/api/:path*',
                destination: 'http://host.docker.internal:8000/api/:path*/',
            }
        ]
    }
};
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?