mirror of
https://github.com/zizifn/edgetunnel
synced 2024-11-22 18:07:07 +00:00
change vless to 401 for http
This commit is contained in:
parent
2611711887
commit
8ee741e73d
@ -33,4 +33,11 @@ const index401 = `
|
||||
|
||||
</html>`;
|
||||
|
||||
export { index401 };
|
||||
const page404 = `
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<div class="theme-default-content"><h1>404</h1><blockquote>There's nothing here.</blockquote><a href="/" class="">Take me home</a></div>
|
||||
</html>
|
||||
`;
|
||||
|
||||
export { index401, page404 };
|
||||
|
@ -4,6 +4,7 @@ import {
|
||||
vlessJs,
|
||||
} from 'vless-js';
|
||||
import { connect } from 'cloudflare:sockets';
|
||||
import { page404 } from './util';
|
||||
|
||||
interface Env {
|
||||
KV: KVNamespace;
|
||||
@ -21,8 +22,12 @@ export const onRequest: PagesFunction<Env> = async (context) => {
|
||||
|
||||
const upgradeHeader = context.request.headers.get('Upgrade');
|
||||
if (!upgradeHeader || upgradeHeader !== 'websocket') {
|
||||
return new Response(`Expected Upgrade: websocket`, {
|
||||
status: 404,
|
||||
return new Response(``, {
|
||||
status: 401,
|
||||
headers: {
|
||||
'content-type': 'text/html; charset=utf-8',
|
||||
'WWW-Authenticate': 'Basic',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user