Skip to content

Commit

Permalink
updated web page
Browse files Browse the repository at this point in the history
  • Loading branch information
s-archer committed Sep 9, 2024
1 parent 46a01b1 commit de42d29
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions http.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,32 @@ function summary(r) {
}


// function redirect(r) {
// // Get the incoming Host header
// const hostname = r.headersIn["Host"];

// // Get the request URI (path and query parameters)
// const requestUri = r.uri;

// // Combine the hostname with the request URI
// const fullUrl = `http://${hostname}/redirected`;

// // Perform the redirect
// r.redirect(fullUrl);
// }

function redirect(r) {
// Get the incoming Host header
const hostname = r.headersIn["Host"];

// Get the request URI (path and query parameters)
const requestUri = r.uri;

// Combine the hostname with the request URI
const fullUrl = `http://${hostname}/redirected`;
// Set the Location header to the new URL
r.headersOut['Location'] = `http://${hostname}/redirected`;

// Perform the redirect
r.redirect(fullUrl);
// Return the 301 status code for a permanent redirect
r.return(301);
}


function generateHtml(title, bodyText) {
return `
<!DOCTYPE html>
Expand Down

0 comments on commit de42d29

Please sign in to comment.