Skip to content

Commit

Permalink
feat(sources) uploading sources
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmrval committed Aug 5, 2024
1 parent e70e069 commit 3d2cb71
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* -text
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ go.work.sum

# env file
.env

build/*
3 changes: 3 additions & 0 deletions src/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module itsmrval/http-to-https

go 1.22.5
18 changes: 18 additions & 0 deletions src/main.go
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit 3d2cb71

Please sign in to comment.