μΌ | μ | ν | μ | λͺ© | κΈ | ν |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- javascript
- React
- Spring
- AWS EC2
- github
- fastapi
- macbook
- 500
- python
- error
- MUI
- nodejs
- js
- ngrok
- docker
- axios
- Java
- Express
- EC2
- deploy
- webhook
- springboot
- MongoDB
- Github Actions
- Troubleshooting
- Jenkins
- TypeScript
- RDS
- AWS
- linux
- Today
- Total
BEAT A SHOTGUN
[ERROR] Set up a proxy and set up multiple proxies λ³Έλ¬Έ
μμπ
Set up
νλ‘μ νλλ₯Ό μ€μ νλ λ°©λ²μ μ½λ€.
νλ‘μ μ¬λ¬ κ°λ μ΄λ»κ² νμ§?
μΌλ¨ νλ‘μ νλλ
package.json
μproxy:"λ³κ²½ν μ£Όμ"
λ₯Ό μ μ΄λ£μΌλ©΄ λλ€.
proxyμ€μ
λ§μ½ proxy λ₯Ό μ μ μ΄ λ£μΌλ©΄ CORS μλ¬κ° λ°μνλ€.
μΌλ¨ λ£μ΄λκ³ μ λλ€ μΆμλλ°...
μν©π€·βοΈ
λ¬Έμ λ λ΄κ° μμ²μ 보λ΄μΌνλ κ³³μ΄ μ¬λ¬ κ°λ€ π€¦βοΈ
νκ΅ν¬μμ¦κΆμ openapivts
μ 곡곡λ°μ΄ν°ν¬νΈμ seibro
λ‘ κ°κ° μμ²ν΄μΌνλ μν©μ΄ λμλ€.
proxy λ νκ΅ν¬μμ¦κΆμ openapivts μ£Όμλ§ μ μ΄λμμλ€.
ERROR β
κ·Έλ¬λ©΄ seibro
λ‘ μμ²μ λ³΄λΌ λ μλ¬κ° λλ€.
seibro
λ‘ path λ§ λ³΄λΌ μ μμΌλ.. proxy μ€μ μ ν΄μ€μΌνλλ°
μ΄λ»κ² ν κΉ μ°Ύμ보λ€
Method 1 β
μ΄λ κ² ν΄λ΄€λλ°
)
μ°Έκ³ : stackoverflow
CRA v2(Create-React-App) λΆν° λ°λμλ보λ€.
μ°Έκ³ : CRA V2 릴리μ¦! λ¬΄μ¨ λ³κ²½ μ¬νμ΄ μμκΉ?
Method 2 β
http-proxy-middleware
λ₯Ό μ¬μ©ν΄λ³΄μ.
npm install http-proxy-middleware --save
λ₯Ό μ΄μ©ν΄ μ€μΉνλ€.package.json
μ μλ"proxy" : " ... "
μ μ§μ΄λ€.- src ν΄λ μμ
setupProxy.js
λ₯Ό λ§λ λ€. - κ±°κΈ°μ proxy λ₯Ό μ¬λ¬κ° λ±λ‘νλ©΄ λλ€!!
- μ½λλ₯Ό λ£μ΄λ³΄μ
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = (app) => {
app.use(
createProxyMiddleware('/oauth2',{
target:'[https://openapivts.koreainvestment.com:29443'](https://openapivts.koreainvestment.com:29443'),
changeOrigin:true
})
)
app.use(
createProxyMiddleware('/uapi',{
target:'[https://openapivts.koreainvestment.com:29443'](https://openapivts.koreainvestment.com:29443'),
changeOrigin:true
})
)
app.use(
createProxyMiddleware('/openapi',{
target:'[http://api.seibro.or.kr'](http://api.seibro.or.kr'),
changeOrigin:true
})
)
}
- μ΄λ κ² ν λ€μ
axios
μλpath
λ§ λ£μ΄μ£Όλ©΄ μ μλνλ€.
μ°Έκ³ :Create React App