🐛 Remove origin from request headers
This commit is contained in:
parent
1564d2ef07
commit
875576ef2d
@ -1,10 +1,6 @@
|
||||
import type {H3Event} from "h3";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
handleCors(event, {
|
||||
origin: '*',
|
||||
methods: '*'
|
||||
});
|
||||
const user = process.env.NUXT_PRIVATE_SUPERUSER_USER;
|
||||
const password = process.env.NUXT_PRIVATE_SUPERUSER_PASSWORD;
|
||||
if (user == null || password == null)
|
||||
@ -13,13 +9,11 @@ export default defineEventHandler(async (event) => {
|
||||
throw Error();
|
||||
}
|
||||
|
||||
const credentials: string = "Basic " + Buffer.from(user + ':' + password).toString('base64');
|
||||
|
||||
event.headers.delete("host");
|
||||
event.headers.delete("origin");
|
||||
event.headers.set("authorization", "Basic " + Buffer.from(user + ':' + password).toString('base64'))
|
||||
|
||||
console.log(event.headers);
|
||||
|
||||
console.log(process.env.NUXT_PUBLIC_BASE_URL);
|
||||
event.headers.set("authorization", credentials)
|
||||
|
||||
return sendProxy(event, process.env.NUXT_PUBLIC_BASE_URL + event.path, {
|
||||
fetchOptions: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user