Spaces:
Running
Running
update login url + remove same origin
Browse files
app/api/auth/login-url/route.ts
CHANGED
|
@@ -5,9 +5,9 @@ export async function GET(req: NextRequest) {
|
|
| 5 |
|
| 6 |
let url: string;
|
| 7 |
if (process.env.NODE_ENV === "production") {
|
| 8 |
-
url = "deepsite.hf.
|
| 9 |
} else if (host.includes("/spaces/enzostvs")) {
|
| 10 |
-
url = "enzostvs-deepsite.hf.space";
|
| 11 |
} else {
|
| 12 |
url = host;
|
| 13 |
}
|
|
|
|
| 5 |
|
| 6 |
let url: string;
|
| 7 |
if (process.env.NODE_ENV === "production") {
|
| 8 |
+
url = "enzostvs-deepsite-v3.hf.space’";
|
| 9 |
} else if (host.includes("/spaces/enzostvs")) {
|
| 10 |
+
url = "enzostvs-deepsite-v3.hf.space";
|
| 11 |
} else {
|
| 12 |
url = host;
|
| 13 |
}
|
app/api/proxy/route.ts
CHANGED
|
@@ -20,6 +20,8 @@ export async function GET(req: NextRequest) {
|
|
| 20 |
try {
|
| 21 |
const spaceDomain = `${spaceId.replace("/", "-")}${commitId !== null? `--rev-${commitId.slice(0, 7)}` : ""}.static.hf.space`;
|
| 22 |
const targetUrl = `https://${spaceDomain}${path}`;
|
|
|
|
|
|
|
| 23 |
|
| 24 |
const response = await fetch(targetUrl, {
|
| 25 |
headers: {
|
|
@@ -225,12 +227,10 @@ export async function GET(req: NextRequest) {
|
|
| 225 |
headers: {
|
| 226 |
'Content-Type': contentType,
|
| 227 |
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
| 228 |
-
'X-Frame-Options': 'SAMEORIGIN',
|
| 229 |
},
|
| 230 |
});
|
| 231 |
|
| 232 |
} catch (error) {
|
| 233 |
-
console.error('Proxy error:', error);
|
| 234 |
return NextResponse.json({
|
| 235 |
error: "Proxy request failed",
|
| 236 |
details: error instanceof Error ? error.message : String(error),
|
|
|
|
| 20 |
try {
|
| 21 |
const spaceDomain = `${spaceId.replace("/", "-")}${commitId !== null? `--rev-${commitId.slice(0, 7)}` : ""}.static.hf.space`;
|
| 22 |
const targetUrl = `https://${spaceDomain}${path}`;
|
| 23 |
+
|
| 24 |
+
console.log("targetUrl", targetUrl);
|
| 25 |
|
| 26 |
const response = await fetch(targetUrl, {
|
| 27 |
headers: {
|
|
|
|
| 227 |
headers: {
|
| 228 |
'Content-Type': contentType,
|
| 229 |
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
|
|
| 230 |
},
|
| 231 |
});
|
| 232 |
|
| 233 |
} catch (error) {
|
|
|
|
| 234 |
return NextResponse.json({
|
| 235 |
error: "Proxy request failed",
|
| 236 |
details: error instanceof Error ? error.message : String(error),
|