Skip to content

Commit abc95ec

Browse files
committed
* added reverse proxy
1 parent 4340697 commit abc95ec

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

face-login/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,26 @@ for testing or creating proof of concepts.
55
# Requirements
66
Vite requires Node.js version 14.18+, 16+. some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.
77

8+
# Backend Server
9+
A backend server that will generate the url is needed for this sample,
10+
luckily for you we already have sample server for PHP, NodeJS, Python,
11+
PHP and Java and .NET, please reffer to our documentation on subject:
12+
[Quick Start Sample Server](https://developer.incode.com/docs/quick-start-servers)
13+
14+
In order to simplfy development, this repo is configured to reverse
15+
proxy a local backend server (`http://localhost:3000`) in the `/api`
16+
url like `https://<your-ip>:5173/api`, if you want to point your
17+
frontend development to a backend server deployed elsewhere, change
18+
the VITE_TOKEN_SERVER_URL to the full url of such server.
19+
820
# Install
921
Run `npm install`
22+
1023
# Config
1124
Copy `.env.example` to `.env.local` and add your local values
1225
```
1326
VITE_API_URL=https://demo-api.incodesmile.com
14-
VITE_SDK_URL=https://sdk.incode.com/sdk/onBoarding-1.60.0.js
27+
VITE_SDK_URL=https://sdk.incode.com/sdk/onBoarding-1.68.0.js
1528
VITE_CLIENT_ID=
1629
VITE_FLOW_ID=
1730
```

face-login/vite.config.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ import { defineConfig } from 'vite'
22
import mkcert from 'vite-plugin-mkcert'
33

44
export default defineConfig({
5-
server: { https: true },
5+
server: {
6+
https: true,
7+
proxy: {
8+
'/api': {
9+
target: 'http://localhost:3000',
10+
changeOrigin: true,
11+
secure: false,
12+
ws: true,
13+
rewrite: (path) => path.replace(/^\/api/, ''),
14+
}
15+
},
16+
},
617
plugins: [ mkcert() ]
718
})

0 commit comments

Comments
 (0)