2

i get a 400 bad request error "Your browser sent an invalid request." when i want to reach my website. Here is the error i get in the console :

enter image description here

My server code :

import { Application} from "https://deno.land/x/oak@v12.1.0/mod.ts";
import { send } from "https://deno.land/x/oak@v11.1.0/send.ts";
import { viewEngine, ejsEngine, oakAdapter } from "https://deno.land/x/view_engine@v10.5.1/mod.ts";


import router from './routes.ts';



const port = Deno.env.get("PORT") || 4000

const app = new Application()

app.use(viewEngine(oakAdapter, ejsEngine));

app.use(router.routes());
app.use(router.allowedMethods());

app.use(async(ctx,next) => {
  await send(ctx,ctx.request.url.pathname,{
      root: `${Deno.cwd()}`
  });
  next();
});







try{
  console.log(`Server running on port ${port}`);
  await app.listen({port, certFile: "./sites/vainastar.com/vainastar.com-2023-03-27.crt", keyFile:"./sites/vainastar.com/vainastar.com-2023-03-27.key", alpnProtocols: ["h2", "http/1.1"],secure:true});
  
}catch(e) {
  console.log("there is an error");
  console.log(e);
}

I added alpnprotocols option but no changes, i'll try to reload the cache too ... is anyone know what this error can be about ?

i'm reading this old discussion from github, i think my issue could be related to what they have been through with Deno ... And SSL certs. I think that i must use a proxy for requests or switch to node.js :(

https://github.com/denoland/deno/issues/6427

https://github.com/denoland/deno/issues/6427

Kogami997
  • 33
  • 5

1 Answers1

1

Since my site is in a web hosting remote server (cloud server), i didn't need cert files to have https, because i was under a proxy provided by the hoster, only the port is necessary, and so i had to behavior like an http app ...

Kogami997
  • 33
  • 5