configure_vite_proxy_and_relative_api_urls_for_ngrok_compatibility
This commit is contained in:
parent
741705f90a
commit
4efbd49c72
@ -28,7 +28,7 @@ app.use(helmet({
|
||||
useDefaults: false,
|
||||
directives: {
|
||||
"default-src": helmet.contentSecurityPolicy.dangerouslyDisableDefaultSrc,
|
||||
"frame-ancestors": ["'self'", "http://localhost:5173", "http://localhost:5000"],
|
||||
"frame-ancestors": ["'self'", "http://localhost:5173", "http://localhost:5000", "https://*.ngrok-free.dev", "https://*.ngrok.io"],
|
||||
},
|
||||
},
|
||||
frameguard: false,
|
||||
|
||||
@ -210,7 +210,7 @@ export const DocumentPreviewModal: React.FC<DocumentPreviewModalProps> = ({
|
||||
};
|
||||
|
||||
const fileHost = (
|
||||
import.meta.env.VITE_API_URL || "http://localhost:5000/api/v1"
|
||||
import.meta.env.VITE_API_URL || "/api/v1"
|
||||
).replace("/api/v1", "");
|
||||
const isBothVerified = verifiedDocs.nda && verifiedDocs.msa;
|
||||
const isCurrentVerified =
|
||||
|
||||
@ -15,7 +15,7 @@ export const ClientAgreementsPage: React.FC = () => {
|
||||
const ndaAcceptance = acceptances?.find(a => a.document.type === 'NDA');
|
||||
const msaAcceptance = acceptances?.find(a => a.document.type === 'MSA');
|
||||
|
||||
const fileHost = (import.meta.env.VITE_API_URL || 'http://localhost:5000/api/v1').replace('/api/v1', '');
|
||||
const fileHost = (import.meta.env.VITE_API_URL || '/api/v1').replace('/api/v1', '');
|
||||
|
||||
// Header component
|
||||
const headerNode = (
|
||||
|
||||
@ -31,7 +31,7 @@ export const InvitePage: React.FC = () => {
|
||||
|
||||
const validateToken = async () => {
|
||||
try {
|
||||
const response = await axios.get(`${import.meta.env.VITE_API_URL || 'http://localhost:5000/api/v1'}/auth/invite/${token}`);
|
||||
const response = await axiosInstance.get(`/auth/invite/${token}`);
|
||||
setEmail(response.data.email);
|
||||
setStatus('valid');
|
||||
} catch (err) {
|
||||
|
||||
@ -90,7 +90,7 @@ export const OnboardingPage: React.FC = () => {
|
||||
};
|
||||
|
||||
const renderDocumentViewer = (type: DocumentType) => {
|
||||
const fileHost = (import.meta.env.VITE_API_URL || 'http://localhost:5000/api/v1').replace('/api/v1', '');
|
||||
const fileHost = (import.meta.env.VITE_API_URL || '/api/v1').replace('/api/v1', '');
|
||||
const pdfUrl = type === 'NDA' ? ndaPdfUrl : msaPdfUrl;
|
||||
|
||||
if (pdfUrl) {
|
||||
|
||||
@ -125,7 +125,7 @@ export const LegalTemplatesPage: React.FC = () => {
|
||||
};
|
||||
|
||||
const currentDoc = activeTab === 'NDA' ? ndaDoc : msaDoc;
|
||||
const fileHost = (import.meta.env.VITE_API_URL || 'http://localhost:5000/api/v1').replace('/api/v1', '');
|
||||
const fileHost = (import.meta.env.VITE_API_URL || '/api/v1').replace('/api/v1', '');
|
||||
|
||||
// Header component
|
||||
const headerNode = (
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import axios from 'axios';
|
||||
|
||||
export const axiosInstance = axios.create({
|
||||
baseURL: import.meta.env.VITE_API_URL || 'http://localhost:5000/api/v1',
|
||||
baseURL: import.meta.env.VITE_API_URL || '/api/v1',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
||||
@ -10,6 +10,18 @@ export default defineConfig({
|
||||
"toughly-coinstantaneous-dimple.ngrok-free.dev",
|
||||
"spruce-fridge-destiny.ngrok-free.dev"
|
||||
],
|
||||
cors: true
|
||||
cors: true,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:5000',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
'/uploads': {
|
||||
target: 'http://localhost:5000',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user