ahngunc0881
@ahngunc0881
Reviews Written
4
Average Rating
5.0
Posts
Q&A
https ๋๋ฉ์ธ์ proxy์ ๋ํด ๋ฌธ์ ๋๋ฆฝ๋๋ค.
nginx ์ ์ค์ ์ ์ถ๊ฐ ํ์์ต๋๋ค. express์ ์ถ๊ฐํ๋ผ๊ณ ๋ง์ํ์ ์ฝ๋๋ ์์ค ์ด๋ ๋ถ๋ถ์ ์ถ๊ฐ ํด์ผํ๋๊ฑด๊ฐ์? /server/index.js์ ํ์ผ ๋ง๋ค์ด์ ์ถ๊ฐํด์ผํ ๊น์? ๊ฐ์ ํ๋ฐ๋ถ์ ๋ณด๋ฉด ๋ฐฐํฌํ ๋ server.js ํ์ผ ์ฐธ๊ณ ํด์ ํด๋ณด์๋๋ฐ proxy๊ฐ ์๋๋๊ฒ ๊ฐ์ ์ฌ์ญค๋ด ๋๋ค.
- 0
- 14
- 2.5K
Q&A
https ๋๋ฉ์ธ์ proxy์ ๋ํด ๋ฌธ์ ๋๋ฆฝ๋๋ค.
๋ต๋ณ ๊ฐ์ฌํฉ๋๋ค. proxy ์ฒ๋ฆฌ ํ๊ธฐ์ํด ์๋ ์์ค ์ฒ๋ผ ์์ฑํด์ ํ ์คํธ ์๋ฒ ํ๊ฒฝ์์ ์ ์ ๋๋๊ฑด ํ์ธ ํ์์ต๋๋ค. https://11.11.11.11/api/getData ---> http://192.168.1.11:1004/api/getData ๋ฐฑ์๋ API์๋ฒ(์๋์ฐํ๊ฒฝ์ด์ด์ nginx ์ ์ฉ์๋จ)์์ ๋ก๊ทธ๋ ํ์ธํ์ต๋๋ค. ์ ๊ฐ ๊ถ๊ธํ๊ฑด ํ ์คํธ ์๋ฒ์์ npm run start๋ก ํ ์คํธ ํ์๋๋ proxy๊ฐ ์ ๋์๋๋ฐ ์คํ ์ด์ง ํ๊ฒฝ์ nginx๊ฐ ์๋จ์ ์ ์ฉ๋๋ ์๋๊ธฐ ๋๋ฌธ์(nginx์ reverse proxy๋ก ์ธํ ๊ผฌ์?) nuxt ๋๋ nginx์ ์ค์ ์ ์ถ๊ฐ๋ก ํด์ค์ผ ํ๋์ง? ์ ๋๋ค. ํ ์คํธํ๋ ์์ค๋ cli๋ก ๋ง๋ nuxt ํ๋ก์ ํธ์ nuxtjs/axios, nuxtjs/proxy ๋ง ์ค์น๋ ์ฌํํ ์ํ์ ๋๋ค. (์์ค ๋ณด์๊ณ ์ ํ๋ฉด ๋ฉ์ผ๋ก ๋๋ฆฌ๊ฒ ์ต๋๋ค~) -----ํ ์คํธ ์๋๋ฆฌ์ค(์ฑ๊ณต)-------- A์๋ฒ(์๋ฒํ๊ฒฝ) nuxt.js 1003port ๋ฐฑ์๋ 1004port B์๋ฒ(์ฌ์ฉ์ํ๊ฒฝ) B์๋ฒ์์ ๋ธ๋ผ์ฐ์ ์ 192.168.1.11:1003 ์ ๋ ฅํ์ฌ ์ฌ์ดํธ๋ฅผ ์ด๊ณ ํ ์คํธ api ํธ์ถ์ API ๋ฐ์ดํฐ ์กฐํ ์ฑ๊ณต A์๋ฒ์ ๋ฐฑ์๋ ๋ก๊ทธ๋ฅผ ์กฐํํ๋ฉด API ํธ์ถํ ๊ธฐ๋ก์ด ๋จ์ ์๊ณ ์ ์ํ ๋ก๊ทธ๋ B์๋ฒ IP์. ์ฆ ์๋ฒ๋จ proxy๋ก ์ ์ ์ํ๊ฑธ๋ก ๋ณด์ฌ์ง. -----์์ค-------- index.vue this.$axios.get(`http://192.168.1.11:1003/api/getData`) nuxt.config.js proxy: { '/api': 'http://192.168.1.11:1004/', },
- 0
- 14
- 2.5K
Q&A
https ๋๋ฉ์ธ์ proxy์ ๋ํด ๋ฌธ์ ๋๋ฆฝ๋๋ค.
๊ณ์๋ ์ง๋ฌธ์ ์น์ ํ ๋ต๋ณํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค. ์ ๊ฐ ์ดํด๋ฅผ ๋ชปํด์ ๊ทธ๋ฐ์ง ํท๊ฐ๋ ค์ ํ์ธ๋ถํ๋๋ฆฝ๋๋ค. ๋ธ๋ผ์ฐ์ (axios) https://11.11.11.11/api/getdata => nginx(11.11.11.11) nginx proxy๋ก => nuxt.js(0.0.0.0:3000) => nuxt.js proxy๋ก 192.168.1.11:1004/api/getData ๋ค์ ์์ฒญ => ๋ฐฑ์๋ API (192.168.1.11) ํธ์ถ ์ด๋ ๊ฒ ๋ ๊บผ๋ผ ์๊ฐ ํ๋๋ฐ์. ์ ๊ฐ ์๊ฐํ ํ๋ฆ๊ณผ ๊ฐ์ฌ๋์ด ์์ ์ ์ด์ฃผ์ ๋ด์ฉ๊ณผ ์์ดํฉ๋๋ค. ์ ๊ฐ ์๋ชป ์ดํดํ๊ณ ์๋๊ฑธ๊น์? ์์์ ๋ฐฑ์๋ ๋ ธ๋(0.0.0.0)์ด๋ผ๊ณ ํ์ จ๋๋ฐ ๋ฐฑ์๋ API๋ 0.0.0.0 ์๋๋ผ 192.168.1.11:1004 ์ ๋๋ค. ์๋ฒ ์ ๋ณด๋ ์๋์ ๊ฐ์ต๋๋ค. 1.ํ๋ก ํธ -์น์๋ฒ( nginx) : 11.11.11.11 (https://11.11.11.11/api/getdata) -nuxt.js express server : 0.0.0.0:3000 2.๋ฐฑ์๋ -api์๋ฒ : 192.168.1.11:1004/api/getData 3.nuxt.config.js ์ proxy : '/api': 'http://192.168.1.11:1004/', nginx conf๋ ๋ง์์ ์ฐธ๊ณ + nuxtjs.org document ์ฐธ๊ณ ํด์ ์์ ํ ์ํ์ ๋๋ค.
- 0
- 14
- 2.5K
Q&A
https ๋๋ฉ์ธ์ proxy์ ๋ํด ๋ฌธ์ ๋๋ฆฝ๋๋ค.
๋ก๊ทธ๋ฅผ ํ์ธํด๋ณด๋ ๋ฐฑ์๋ API ์๋ฒ์ ์ ๊ทผํ์ง ์์๊ฒ ๊ฐ์ต๋๋ค. ์ ์๊ฐ์๋ nuxt.js์์ API๊ฐ ํธ์ถ๋๋ (์ถ๋ฐ)nginx --> node.js --> (๋์ฐฉ)๋ฐฑ์๋ API ํ๋ฆ์์ 1.API ํธ์ถ this.$axios.get(`https://11.11.11.11/api/getData`) 2.node.js http://0.0.0.0:3000 ์ ํ๋ฆ์์ nginx ๋ฆฌ๋ฒ์ค ํ๋ก์๋ก ์ธํด nuxt.js proxy์ ์ถฉ๋(?)์ด ์๊ธฐ๋๊ฑด ์๋์ง์? ๊ทธ๋ฆฌ๊ณ ์์์ ๋ง์์ฃผ์ express(app.set('trust proxy', 1)์ express-session(proxy: true) ๋ถ๋ถ์ node.js ์ค์ ์ธ๊ฒ ๊ฐ์๋ฐ ์์ค ์ด๋ ๋ถ๋ถ์ ์ ์ฉํด์ผํ๋์?
- 0
- 14
- 2.5K
Q&A
https ๋๋ฉ์ธ์ proxy์ ๋ํด ๋ฌธ์ ๋๋ฆฝ๋๋ค.
404 ์๋ฌ๊ฐ ๋ฐ์ํฉ๋๋ค. ์๋ ๋ด์ฉ์ ๊ฐ๋ฐ์ ๋๊ตฌ์์ ํ์ธ ํ ๋ด์ฉ์ ๋๋ค. ์์ค์๋ ์ด์์ด ์์ ๊ฒ ๊ฐ์ต๋๋ค. ๊ฐ์ ์์ค๋ฅผ ๋ค๋ฅธ ํ ์คํธ ์๋ฒ(windows)์ ์ฌ๋ฆฌ๊ณ build/start๋ก ์คํํ์ฌ ํ ์คํธ ํ๋ฉด ์ํ๋ ๊ฒฐ๊ณผ๊ฐ ๋์ต๋๋ค. ์ง๋ฌธ 1. ์๋ ์ ์ก๊ฒฐ๊ณผ๋ฅผ ํตํด ์ค๋ฅ ํ์ธ ๊ฐ๋ฅํ ๊น์? 2. nginx๋ฅผ ๋นผ๊ณ node.js๋ก๋ง ์ด์ํ๋ฉด ๋ฌธ์ ๊ฐ ์์๊น์? ๊ฐ์ฌํฉ๋๋ค. ----์ ์ก๊ฒฐ๊ณผ---- Genaeral Request URL: https://11.11.11.11/api/getData Request Method: GET Status Code: 404 Remote Address: 11.11.11.11:443 Referrer Policy: no-referrer-when-downgrade Response Headers accept-ranges: none content-type: text/html; charset=utf-8 date: Thu, 03 Sep 2020 09:03:16 GMT server: nginx status: 404 vary: Accept-Encoding via: 1.1 google Request Headers :authority: 11.11.11.11 :method: GET :path: /api/getData :scheme: https accept: application/json, text/plain, */* accept-encoding: gzip, deflate, br accept-language: ko cache-control: no-cache pragma: no-cache referer: https://11.11.11.11/ sec-fetch-dest: empty sec-fetch-mode: cors sec-fetch-site: same-origin user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
- 0
- 14
- 2.5K
Q&A
https ๋๋ฉ์ธ์ proxy์ ๋ํด ๋ฌธ์ ๋๋ฆฝ๋๋ค.
๋ต๋ณ ๊ฐ์ฌํฉ๋๋ค. ์ IP๋ ์ํ๋ก ์์ฑํ ๊ฒ์ ๋๋ค. ์๋ฒ๊ฐ์ ํต์ ์ด ์ฑ๊ณต๋๊ฑด ์ฒดํฌํ์ต๋๋ค. ๊ทธ๋ ๋ค๋ฉด ์ ์ฝ๋ ์์ผ๋ก๋ ๋์ด์ผํ๋ค๊ณ ์ดํดํ๋ฉด ๋๊ฒ ๋ค์.. ์ ๊ฐ ์๋๋ฒ์์์ ์ ์ถํ๋ฉด nuxt/proxy๋ฅผ ์ ์ฉํ API๋ฅผ ์์ ๊ฐ์ด ํธ์ถํ๊ฒ ๋๋ค๋ฉด API URL 11.11.11.11 --->192.168.1.11:1004 ๋ก URL์ ๋ณ๊ฒฝํ์ฌ API๋ฅผ ํธ์ถํ๊ฒ๋๊ณ API์๋ฒ์์๋ ์ฌ์ฉ์ IP๊ฐ ์๋ ์๋ฒ IP(11.11.11.11)๋ก hostaddress๊ฐ ํ์ธ๋ฉ๋๋ค. ์ด proxy ์์ ์ node.js ์๋ฒ๋จ ์์ ์ฒ๋ฆฌํด ์ฃผ๋ ๊ฑด๊ฐ์? ๊ทธ๋ ๋ค๋ฉด proxy ์ฒ๋ฆฌ๊ฐ ๋๋ ๊ณผ์ ๋ค์ ์๋ฒ์์ log๋ก ์ฐ์ด์ ํ์ธ๋ ๊ฐ๋ฅํ ๊น์?
- 0
- 14
- 2.5K
Q&A
proxy ๋ฌธ์ ๋๋ฆฝ๋๋ค.
๋ค~~ ๋์ ๊ฐ์ฌํฉ๋๋ค^^
- 0
- 4
- 1.9K
Q&A
proxy ๋ฌธ์ ๋๋ฆฝ๋๋ค.
ํน๋ณํ localhost๋ก ์ค์ ํ์ง๋ ์์๋๋ฐ this.$axios.get(`/api/acc/keys`) ์ด ๋ถ๋ถ์ IP์ง์ ์ ์ํด์ ๊ทธ๋ฌ๋ ๋ด ๋๋ค. /api ์๋ถ๋ถ์ IP ๋ฃ์ผ๋ ์ ๋ฉ๋๋ค. ๋ต๋ณ ๊ฐ์ฌํฉ๋๋ค.
- 0
- 4
- 1.9K
Q&A
Vue ๊ฐ๋ฐ์ ์ธ๋ถ ES5 Script ์ ์ฉ ๋ฌธ์ ๋๋ฆฝ๋๋ค.
๋ค ๋ง์ต๋๋ค. ๋ฌธ์๋ฅผ ์ด๋ ต๊ฒ ์ ์๊ฒ ๊ฐ์ ์ ๋ฆฌํฉ๋๋ค. ๋ ์ง๋ฌธ์ protorype์ผ๋ก ์์ฑ๋ ํจ์(๋๋ function๋ฅผ ์ด๋ป๊ฒ export, importํ์ฌ ์ฌ์ฉํ๋์ง? ์์ต๋๋ค. ---export) script--- export function Crypto(){ this.a =''; this.b = 0 } Crypto.prototype.setInfo =funtion(n,x){.....} Crypto.prototype.encrypt=funtion(n){.....} .. .. -------import) vue------- import {Crypto} from '....'; var crypto = new Crypto(); crypto.setInfo("",""); crypto.encrypt(""); ์ด๋ฐ์์ผ๋ก ์ฌ์ฉ์ด ๊ฐ๋ฅํด์ผ ํ ๊ฒ ๊ฐ์๋ฐ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ฌ ๋ฌธ์ ๋๋ ธ์ต๋๋ค. ๊ฐ์ฌํฉ๋๋ค.
- 0
- 3
- 523
Q&A
์๋ฒ์ฌ์ด๋ ๋๋๋ง ์ ์ฉ์ API ์๋ฒ ์ฐ๋์ ๋ํ ๋ฌธ์ ๋๋ฆฝ๋๋ค.
*ํธ์ถ this.$axios.get(`/feach`) *nuxt.config.js axios: { baseURL: process.env.NODE_ENV === 'production' ? 'https://api.nodebird.com/api' : 'http://localhost:1003/api', }, ์ด๋ ๊ฒ ๋ฐ๊ฟ์ ํธ์ถํด๋ http://localhost:1003/api... ์ผ๋ก request๊ฐ ๊ฐ๋๋ค. proxy๊ฐ ์ํ๋๊ฒ ๊ฐ์ต๋๋ค. ํน์ ๋ค๋ฅธ ์ค์ ๋ ํ์ํ๋์? ๊ณ์ ๋ฌธ์๋ฅผ ๋๋ ค์ ์ฃ์ก์ค๋ฝ์ต๋๋ค. ใ ใ
- 0
- 9
- 893




