cors again

This commit is contained in:
dimitar 2025-04-26 19:08:15 +02:00
parent 42a1af1117
commit 8742ea5714
3 changed files with 27 additions and 12 deletions

View File

@ -22,5 +22,6 @@ export const corsConfig = {
"Authorization",
"posthog-session-id",
"ph-session-id",
"Access-Control-Allow-Origin",
],
};

View File

@ -1,6 +1,6 @@
export const config = {
apiUrl: "https://imkapi.oblak.solutions",
REACT_APP_PUBLIC_POSTHOG_KEY:
"phc_dLQV3ZMDaqyRw0j71BcLwuKCq9CkmKxpKxj3pJwgX7x",
REACT_APP_PUBLIC_POSTHOG_HOST: "https://eu.i.posthog.com",
// REACT_APP_PUBLIC_POSTHOG_KEY:
// "phc_dLQV3ZMDaqyRw0j71BcLwuKCq9CkmKxpKxj3pJwgX7x",
// REACT_APP_PUBLIC_POSTHOG_HOST: "https://eu.i.posthog.com",
};

View File

@ -4,14 +4,28 @@ import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
// cors: {
// origin: [
// "https://eu-assets.i.posthog.com",
// "https://app.posthog.com",
// "https://eu.posthog.com",
// ],
// allowedHeaders: ["posthog-session-id", "ph-session-id"],
// },
proxy: {
"/api": {
target: "https://imkapi.oblak.solutions",
changeOrigin: true,
secure: true,
rewrite: (path) => path.replace(/^\/api/, ""),
configure: (proxy, _options) => {
proxy.on("error", (err, _req, _res) => {
console.log("proxy error", err);
});
proxy.on("proxyReq", (proxyReq, req, _res) => {
console.log("Sending Request to the Target:", req.method, req.url);
});
proxy.on("proxyRes", (proxyRes, req, _res) => {
console.log(
"Received Response from the Target:",
proxyRes.statusCode,
req.url,
);
});
},
},
},
},
});