feat(sources) uploading sources
This commit is contained in:
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* -text
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -23,3 +23,5 @@ go.work.sum
|
|||||||
|
|
||||||
# env file
|
# env file
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
build/*
|
||||||
|
|||||||
3
src/go.mod
Normal file
3
src/go.mod
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module itsmrval/http-to-https
|
||||||
|
|
||||||
|
go 1.22.5
|
||||||
18
src/main.go
Normal file
18
src/main.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
targetURL := "https://" + r.Host + r.RequestURI
|
||||||
|
http.Redirect(w, r, targetURL, http.StatusMovedPermanently)
|
||||||
|
})
|
||||||
|
|
||||||
|
log.Println("Service running on :80")
|
||||||
|
if err := http.ListenAndServe(":80", nil); err != nil {
|
||||||
|
log.Fatalf("%v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user