proxy web via api
This commit is contained in:
parent
5c2aacdb11
commit
59030c7601
@ -23,6 +23,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@fastify/cookie": "^9.1.0",
|
||||
"@fastify/http-proxy": "^9.3.0",
|
||||
"@fastify/static": "^6.12.0",
|
||||
"@nestjs/cache-manager": "^2.1.0",
|
||||
"@nestjs/cli": "^10.1.18",
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
import { AppModule } from './app.module';
|
||||
import { env } from './config/env';
|
||||
import { fastifyCookie } from '@fastify/cookie';
|
||||
import proxy from '@fastify/http-proxy';
|
||||
import type { INestApplication } from '@nestjs/common';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
@ -32,6 +33,11 @@ async function bootstrap() {
|
||||
secret: env.API_SECRET,
|
||||
});
|
||||
|
||||
await app.register(proxy, {
|
||||
http2: false,
|
||||
upstream: 'http://localhost:3000',
|
||||
});
|
||||
|
||||
app.useGlobalPipes(new ValidationPipe({ stopAtFirstError: true }));
|
||||
|
||||
setupOpenApi(app);
|
||||
|
||||
@ -23,7 +23,7 @@ export default function Form() {
|
||||
const data = { login, password };
|
||||
|
||||
axios
|
||||
.post('/signin', data)
|
||||
.post('/login', data)
|
||||
.then(() => {
|
||||
const url =
|
||||
(window.location.pathname.replace(APP_BASE_PATH, '') || '/') +
|
||||
|
||||
50
yarn.lock
50
yarn.lock
@ -471,6 +471,11 @@
|
||||
ajv-formats "^2.1.1"
|
||||
fast-uri "^2.0.0"
|
||||
|
||||
"@fastify/busboy@^2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.0.0.tgz#f22824caff3ae506b18207bad4126dbc6ccdb6b8"
|
||||
integrity sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==
|
||||
|
||||
"@fastify/cookie@^9.1.0":
|
||||
version "9.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@fastify/cookie/-/cookie-9.1.0.tgz#b9ca95fcb934a21915ab6f228a63dd73013738df"
|
||||
@ -492,7 +497,7 @@
|
||||
resolved "https://registry.yarnpkg.com/@fastify/deepmerge/-/deepmerge-1.3.0.tgz#8116858108f0c7d9fd460d05a7d637a13fe3239a"
|
||||
integrity sha512-J8TOSBq3SoZbDhM9+R/u77hP93gz/rajSA+K2kGyijPpORPWUXHUpTaleoj+92As0S9uPRP7Oi8IqMf0u+ro6A==
|
||||
|
||||
"@fastify/error@^3.2.0":
|
||||
"@fastify/error@^3.0.0", "@fastify/error@^3.2.0":
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/@fastify/error/-/error-3.4.0.tgz#30df6601f4edce57a05ec5caaa90a28025a8554a"
|
||||
integrity sha512-e/mafFwbK3MNqxUcFBLgHhgxsF8UT1m8aj0dAlqEa2nJEgPsRtpHTZ3ObgrgkZ2M1eJHPTwgyUl/tXkvabsZdQ==
|
||||
@ -512,6 +517,16 @@
|
||||
fast-querystring "^1.0.0"
|
||||
fastify-plugin "^4.0.0"
|
||||
|
||||
"@fastify/http-proxy@^9.3.0":
|
||||
version "9.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@fastify/http-proxy/-/http-proxy-9.3.0.tgz#7d74c5ab51cd97e3106be33f408b707c091dd94e"
|
||||
integrity sha512-fQkdgwco8q7eI2PQA8lH++y3Q+hNlIByBYsphl+r4FKRbmrU7ey4WOA/CA9tBhe4oEojGpa3eTU4jXvqf2DBuQ==
|
||||
dependencies:
|
||||
"@fastify/reply-from" "^9.0.0"
|
||||
fast-querystring "^1.1.2"
|
||||
fastify-plugin "^4.5.0"
|
||||
ws "^8.4.2"
|
||||
|
||||
"@fastify/middie@8.3.0":
|
||||
version "8.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@fastify/middie/-/middie-8.3.0.tgz#1325e9e4373c98d69366d1e38211337dee1b9ccd"
|
||||
@ -522,6 +537,19 @@
|
||||
path-to-regexp "^6.1.0"
|
||||
reusify "^1.0.4"
|
||||
|
||||
"@fastify/reply-from@^9.0.0":
|
||||
version "9.4.0"
|
||||
resolved "https://registry.yarnpkg.com/@fastify/reply-from/-/reply-from-9.4.0.tgz#7d648cd5221e1aa9a0ec2cd5451f32078c431dd3"
|
||||
integrity sha512-A0rT2o2Y8Xe9+CpS/VCfpWMLyptwI7peljdtdsW3nlLwwMbDr3kxDry5aiIb43SCfI1nr3B5mMH48kerJAZ8YQ==
|
||||
dependencies:
|
||||
"@fastify/error" "^3.0.0"
|
||||
end-of-stream "^1.4.4"
|
||||
fast-querystring "^1.0.0"
|
||||
fastify-plugin "^4.0.0"
|
||||
pump "^3.0.0"
|
||||
tiny-lru "^11.0.0"
|
||||
undici "^5.19.1"
|
||||
|
||||
"@fastify/send@^2.0.0":
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@fastify/send/-/send-2.1.0.tgz#1aa269ccb4b0940a2dadd1f844443b15d8224ea0"
|
||||
@ -3245,7 +3273,7 @@ encodeurl@~1.0.2:
|
||||
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
|
||||
integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==
|
||||
|
||||
end-of-stream@^1.1.0:
|
||||
end-of-stream@^1.1.0, end-of-stream@^1.4.4:
|
||||
version "1.4.4"
|
||||
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
|
||||
integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==
|
||||
@ -4129,7 +4157,7 @@ fast-printf@^1.6.9:
|
||||
dependencies:
|
||||
boolean "^3.1.4"
|
||||
|
||||
fast-querystring@^1.0.0, fast-querystring@^1.1.1:
|
||||
fast-querystring@^1.0.0, fast-querystring@^1.1.1, fast-querystring@^1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/fast-querystring/-/fast-querystring-1.1.2.tgz#a6d24937b4fc6f791b4ee31dcb6f53aeafb89f53"
|
||||
integrity sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg==
|
||||
@ -4158,7 +4186,7 @@ fast-url-parser@^1.1.3:
|
||||
dependencies:
|
||||
punycode "^1.3.2"
|
||||
|
||||
fastify-plugin@^4.0.0:
|
||||
fastify-plugin@^4.0.0, fastify-plugin@^4.5.0:
|
||||
version "4.5.1"
|
||||
resolved "https://registry.yarnpkg.com/fastify-plugin/-/fastify-plugin-4.5.1.tgz#44dc6a3cc2cce0988bc09e13f160120bbd91dbee"
|
||||
integrity sha512-stRHYGeuqpEZTL1Ef0Ovr2ltazUT9g844X5z/zEBFLG8RYlpDiOCIG+ATvYEp+/zmc7sN29mcIMp8gvYplYPIQ==
|
||||
@ -7926,6 +7954,11 @@ through@^2.3.6:
|
||||
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
|
||||
integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==
|
||||
|
||||
tiny-lru@^11.0.0:
|
||||
version "11.2.5"
|
||||
resolved "https://registry.yarnpkg.com/tiny-lru/-/tiny-lru-11.2.5.tgz#b138b99022aa26c567fa51a8dbf9e3e2959b2b30"
|
||||
integrity sha512-JpqM0K33lG6iQGKiigcwuURAKZlq6rHXfrgeL4/I8/REoyJTGU+tEMszvT/oTRVHG2OiylhGDjqPp1jWMlr3bw==
|
||||
|
||||
titleize@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53"
|
||||
@ -8242,6 +8275,13 @@ undici-types@~5.25.1:
|
||||
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.25.3.tgz#e044115914c85f0bcbb229f346ab739f064998c3"
|
||||
integrity sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==
|
||||
|
||||
undici@^5.19.1:
|
||||
version "5.27.0"
|
||||
resolved "https://registry.yarnpkg.com/undici/-/undici-5.27.0.tgz#789f2e40ce982b5507899abc2c2ddeb2712b4554"
|
||||
integrity sha512-l3ydWhlhOJzMVOYkymLykcRRXqbUaQriERtR70B9LzNkZ4bX52Fc8wbTDneMiwo8T+AemZXvXaTx+9o5ROxrXg==
|
||||
dependencies:
|
||||
"@fastify/busboy" "^2.0.0"
|
||||
|
||||
universalify@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
|
||||
@ -8592,7 +8632,7 @@ ws@8.13.0:
|
||||
resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0"
|
||||
integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==
|
||||
|
||||
ws@^8.12.0:
|
||||
ws@^8.12.0, ws@^8.4.2:
|
||||
version "8.14.2"
|
||||
resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f"
|
||||
integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user