blob: 215ecaa49f1f09982c289f90c122fa90cb6fb9bf (
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: AGPL-3.0-only
// 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)
}
|