blob: 2a56411017611202010d91e3bb64920fd41ef36e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// SPDX-License-Identifier: BSD-2-Clause
// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org>
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
)
var reverseProxy *httputil.ReverseProxy
func init() {
parsedURL, err := url.Parse(destHost)
if err != nil {
log.Fatal(err)
}
reverseProxy = httputil.NewSingleHostReverseProxy(parsedURL)
}
func proxyRequest(writer http.ResponseWriter, request *http.Request) {
reverseProxy.ServeHTTP(writer, request)
}
|