Skip to content

Commit

Permalink
Merge pull request #2 from jdavis7257/PullRequest1
Browse files Browse the repository at this point in the history
Added a check for another specific bad URL that was coming in and fix…
  • Loading branch information
jdavis7257 authored Jul 22, 2017
2 parents c92363b + 656da5e commit c5bc707
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Tiny https redirect application written in go for the sole purpose of redirectin
# Configuration
| Environment Variable | Description |
| ---------------------| ------------------------- |
| REDIRECT_HOST | Specifies a host that will replace the host in the request when the redirect url is built. |
| REDIRECT_HOSTNAME | Specifies a host that will replace the host in the request when the redirect url is built. |
| USE_HTTP | Causes the redirect to use HTTP instead of HTTPS. Specifying anything Anything will activate this. (eg,. USE_HTTP=true) |

4 changes: 2 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ deployment:
- go get github.com/tcnksm/ghr
- gox -osarch="linux/amd64" -output="dist/{{.OS}}_{{.Arch}}" ./src/
# - ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace `git describe --tags` dist/
- docker build --tag=jdavis7257/tiny-redirect:0.1 .
- docker build --tag=jdavis7257/tiny-redirect:0.2 .
- docker build --tag=jdavis7257/tiny-redirect:latest .
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- docker push jdavis7257/tiny-redirect:0.1
- docker push jdavis7257/tiny-redirect:0.2
- docker push jdavis7257/tiny-redirect:latest
2 changes: 1 addition & 1 deletion src/redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func handle(w http.ResponseWriter, r *http.Request) {
path := r.RequestURI

//If some passes http as a path then slap them on the hand with a bad request.
if(strings.HasPrefix(path,"/http:") || strings.HasPrefix(path,"/HTTP:")) {
if(strings.HasPrefix(path,"/http:") || strings.HasPrefix(path,"/HTTP:")|| strings.Contains(path,"comhttp")) {
fmt.Println("Someone is trying to do something nasty. Returning 400.")
http.Error(w,"Bad Request",http.StatusBadRequest)
} else {
Expand Down

0 comments on commit c5bc707

Please sign in to comment.