New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many redirects when unknown path #1524

Open
paganotoni opened this Issue Jan 5, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@paganotoni
Copy link
Member

paganotoni commented Jan 5, 2019

Description

When i enter a path that doesn't exist and it doesn't have a file extension (p.e /shshs), router ends up redirecting to the same path many times until the browser stops it.

Steps to Reproduce the Problem

  1. Generated a new app with buffalo new coke --skip-pop
  2. Run the app with buffalo dev
  3. Visited http://localhost:3000/shshs

Expected Behavior

See the 404 error page.

Actual Behavior

Browser ends up saying:

This page isn’t working localhost redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS

And the path URL is changed to:

http://localhost:3000/shshs/shshs/shshs/shshs/shshs/shshs/shshs/shshs/shshs/shshs/shshs/shshs/shshs/shshs/shshs/shshs/shshs/shshs/shshs/

Info

Buffalo Version

v0.13.12

App Information

Pwd=/Users/paganotoni/go/src/github.com/paganotoni/coke
Root=/Users/paganotoni/go/src/github.com/paganotoni/coke
GoPath=/Users/paganotoni/go
Name=coke
Bin=bin/coke
PackagePkg=github.com/paganotoni/coke
ActionsPkg=github.com/paganotoni/coke/actions
ModelsPkg=github.com/paganotoni/coke/models
GriftsPkg=github.com/paganotoni/coke/grifts
VCS=git
WithPop=false
WithSQLite=false
WithDep=false
WithWebpack=true
WithYarn=true
WithDocker=true
WithGrifts=true
WithModules=false

Go Version

go version go1.11.2 darwin/amd64

Go Env

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/paganotoni/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/paganotoni/go"
GOPROXY="http://athens.wawand.co"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.2/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/gg/jnd1lf7s6zx38rcybmddnw3h0000gn/T/go-build913719608=/tmp/go-build -gno-record-gcc-switches -fno-common"

Node Version

v11.4.0

NPM Version

6.5.0

Yarn Version

1.12.3

PostgreSQL Version

pg_ctl (PostgreSQL) 11.0

MySQL Version

MySQL Not Found

SQLite Version

3.24.0 2018-06-04 14:10:15 95fbac39baaab1c3a84fdfc82ccb7f42398b2e92f18a2a57bce1d4a713cbaapl

Dep Version

could not find a Gopkg.toml file

Dep Status

could not find a Gopkg.toml file

@lukasschlueter

This comment has been minimized.

Copy link
Member

lukasschlueter commented Jan 6, 2019

This is caused by app.ServeFiles("/", assetsBox) and (in my understanding) is a bug in packr.

The relevant code should be this:

func (b Box) Open(name string) (http.File, error) {
	plog.Debug(b, "Open", "name", name)
	if len(filepath.Ext(name)) == 0 {
		d, err := file.NewDir(name)
		plog.Debug(b, "Open", "name", name, "dir", d)
		return d, err
	}

file.NewDir(name) seems to unconditionally create a new virtual dir.

I'm working on a fix for that.

@paganotoni

This comment has been minimized.

Copy link
Member

paganotoni commented Jan 6, 2019

Appreciated @lukasschlueter! i tried to look into it but certainly i'm not very familiar with packr internals, looking forward for that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment