Skip to content

Commit

Permalink
πŸ”§ #147 - proxy μ„€μ •
Browse files Browse the repository at this point in the history
- cors μ—λŸ¬ 해결을 μœ„ν•œ μ„€μ •
  • Loading branch information
Bori-github committed Jul 15, 2023
1 parent b93bb55 commit a41b3e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/** @type {import('next').NextConfig} */

const ADD_API = process.env.NEXT_PUBLIC_API_HOST;

const nextConfig = {
images: { // NOTE: images domains 섀정이 μ΅œμƒμœ„μ— μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€.
domains: [
Expand All @@ -24,6 +27,14 @@ const nextConfig = {
});
return config;
},
async rewrites() {
return [
{
source: '/api/v1/:path*',
destination: `${ADD_API}/:path*`,
},
];
},
};

module.exports = nextConfig;
2 changes: 1 addition & 1 deletion src/lib/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getSession } from 'next-auth/react';
import type { AxiosRequestConfig } from 'axios';

const options: AxiosRequestConfig = {
baseURL: process.env.NEXT_PUBLIC_API_HOST,
baseURL: '/api/v1',
headers: {
'Content-Type': 'application/json',
},
Expand Down

0 comments on commit a41b3e5

Please sign in to comment.