You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
We placed our buffalo application behind a route based proxy_pass via NginX.
What this means is -
To visit HomeHandler via / root path, the user has to type http://example.com/app-center/ in the browser.
The NginX would take care of proxy passing this request to 3000 port where the actual buffalo app is running.
Now, the assets path and rest of the paths defined in app.go don't hold good. Because now, all these routes need to be prepended with app-center.
This becomes a problem when developers develop the app independent of how it will be hosted finally. For developers, it is still / and /users/ and so on. But, for the organisation, everything should be under an umbrella route app-center.
It would really help if we could introduce a BASE_PATH config in the .env and use that as the prependable route for every other route in the app.
Steps to Reproduce the Problem
Create a new buffalo app.
Run it on 3000 port.
Configure NginX to proxy pass the requests to 3000 port based on a route-based location block (say location ^~ /app-center { }).
Expected Behavior
Buffalo app should work with all the URLs prepended with app-center in this case.
Actual Behavior
The assets fail to load as the asset URLs are not constructed with /app-center prepended and hence NginX does not match the path.
Even other routes fail similarly (Ex: /users has to become /app-center/users).
Info
-> Go: Checking installation
✓ The `go` executable was found on your system at: /usr/local/Cellar/go/1.14.4/libexec/bin/go
-> Go: Checking minimum version requirements
✓ Your version of Go, 1.14.4, meets the minimum requirements.
-> Go: Checking Package Management
✓ You are using Go Modules (`go`) for package management.
-> Go: Checking PATH
✘ Your PATH (/usr/local/Cellar/go/1.14.4/libexec/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/WebServer/Documents/gonew/bin) does not contain /Library/WebServer/Documents/gonew/bin.
Without /Library/WebServer/Documents/gonew/bin in your `PATH` any Go executables can not be run globally.
For help setting up your Go environment please follow the instructions for you platform at:
https://www.gopherguides.com/courses/preparing-your-environment-for-go-development
-> Node: Checking installation
✓ The `node` executable was found on your system at: /usr/local/bin/node
-> Node: Checking minimum version requirements
✓ Your version of Node, v14.5.0, meets the minimum requirements.
-> NPM: Checking installation
✓ The `npm` executable was found on your system at: /usr/local/bin/npm
-> NPM: Checking minimum version requirements
✓ Your version of NPM, 6.14.5, meets the minimum requirements.
-> Yarn: Checking installation
✓ The `yarnpkg` executable was found on your system at: /usr/local/bin/yarnpkg
-> Yarn: Checking minimum version requirements
✓ Your version of Yarn, 1.22.4, meets the minimum requirements.
-> PostgreSQL: Checking installation
✓ The `postgres` executable was found on your system at: /usr/local/bin/postgres
-> PostgreSQL: Checking minimum version requirements
✓ Your version of PostgreSQL, 12.3.0, meets the minimum requirements.
-> MySQL: Checking installation
✓ The `mysql` executable was found on your system at: /usr/local/bin/mysql
-> MySQL: Checking minimum version requirements
✓ Your version of MySQL, 8.0.18, meets the minimum requirements.
-> SQLite3: Checking installation
✓ The `sqlite3` executable was found on your system at: /usr/bin/sqlite3
-> SQLite3: Checking minimum version requirements
✓ Your version of SQLite3, 3.28.0, meets the minimum requirements.
-> Cockroach: Checking installation
✘ The `cockroach` executable could not be found on your system.
For help setting up your Cockroach environment please follow the instructions for you platform at:
https://www.cockroachlabs.com/docs/stable/
-> Buffalo (CLI): Checking installation
✓ The `buffalo` executable was found on your system at: /Library/WebServer/Documents/gonew/bin/buffalo
-> Buffalo (CLI): Checking minimum version requirements
✓ Your version of Buffalo (CLI), v0.16.10, meets the minimum requirements.
-> Buffalo: Application Details
Pwd /Library/WebServer/Documents/gonew/src/gitlab.dailyhunt.in/arun.kolhapur/dh_ad_center
Root /Library/WebServer/Documents/gonew/src/gitlab.dailyhunt.in/arun.kolhapur/dh_ad_center
GoPath /Library/WebServer/Documents/gonew
PackagePkg github.com/arun.kolhapur/dh_ad_center
ActionsPkg github.com/arun.kolhapur/dh_ad_center/actions
ModelsPkg github.com/arun.kolhapur/dh_ad_center/models
GriftsPkg github.com/arun.kolhapur/dh_ad_center/grifts
WithModules true
Name dh-ad-center
Bin bin/dh-ad-center
VCS git
WithPop true
WithSQLite false
WithDep false
WithWebpack true
WithNodeJs true
WithYarn true
WithDocker true
WithGrifts true
AsWeb true
AsAPI false
InApp true
PackageJSON {map[build:webpack -p --progress dev:webpack --watch]}
-> Buffalo: config/auth_model.conf
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = r.sub == p.sub && keyMatch(r.obj, p.obj) && (r.act == p.act || p.act == "*")
-> Buffalo: config/buffalo-app.toml
name = "dh-ad-center"
bin = "bin/dh-ad-center"
vcs = "git"
with_pop = true
with_sqlite = false
with_dep = false
with_webpack = true
with_nodejs = true
with_yarn = true
with_docker = true
with_grifts = true
as_web = true
as_api = false
-> Buffalo: config/buffalo-plugins.toml
[[plugin]]
binary = "buffalo-auth"
go_get = "github.com/gobuffalo/buffalo-auth"
[[plugin]]
binary = "buffalo-pop"
go_get = "github.com/gobuffalo/buffalo-pop/v2"
-> Buffalo: config/policy.csv
p, Admin, *, *
-> Buffalo: go.mod
module github.com/arun.kolhapur/dh_ad_center
go 1.14
require (
github.com/Masterminds/semver/v3 v3.1.0 // indirect
github.com/arrowak/buffalo-cascan v0.0.0-20200716064005-53eadb56c3bd
github.com/arrowak/go-widgets v0.0.0-20160908140342-1ad2a1cebddd
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/gobuffalo/buffalo v0.16.10
github.com/gobuffalo/buffalo-pop/v2 v2.0.6
github.com/gobuffalo/envy v1.9.0
github.com/gobuffalo/fizz v1.11.0 // indirect
github.com/gobuffalo/mw-csrf v1.0.0
github.com/gobuffalo/mw-forcessl v0.0.0-20180802152810-73921ae7a130
github.com/gobuffalo/mw-i18n v0.0.0-20190129204410-552713a3ebb4
github.com/gobuffalo/mw-paramlogger v0.0.0-20190129202837-395da1998525
github.com/gobuffalo/nulls v0.4.0
github.com/gobuffalo/packr/v2 v2.8.0
github.com/gobuffalo/pop/v5 v5.2.3
github.com/gobuffalo/suite/v3 v3.0.0
github.com/gobuffalo/validate/v3 v3.3.0
github.com/gobuffalo/x v0.0.0-20190224155809-6bb134105960
github.com/gofrs/uuid v3.3.0+incompatible
github.com/jackc/pgx/v4 v4.7.1 // indirect
github.com/karrick/godirwalk v1.15.6 // indirect
github.com/lib/pq v1.7.0 // indirect
github.com/markbates/grift v1.5.0
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/microcosm-cc/bluemonday v1.0.3 // indirect
github.com/monoculum/formam v0.0.0-20200527175922-6f3cce7a46cf // indirect
github.com/pkg/errors v0.9.1
github.com/rogpeppe/go-internal v1.6.0 // indirect
github.com/sirupsen/logrus v1.6.0 // indirect
github.com/spf13/cobra v1.0.0 // indirect
github.com/unrolled/secure v0.0.0-20190103195806-76e6d4e9b90c
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899
golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 // indirect
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
)
The text was updated successfully, but these errors were encountered:
There's an exported field in the buffalo.Options struct named Prefix. Have you tried setting that to the path of the proxy_pass'd location in your nginx conf?
Description
We placed our buffalo application behind a route based proxy_pass via NginX.
What this means is -
To visit
HomeHandler
via/
root path, the user has to typehttp://example.com/app-center/
in the browser.The NginX would take care of proxy passing this request to
3000
port where the actual buffalo app is running.Now, the
assets
path and rest of the paths defined inapp.go
don't hold good. Because now, all these routes need to be prepended withapp-center
.This becomes a problem when developers develop the app independent of how it will be hosted finally. For developers, it is still
/
and/users/
and so on. But, for the organisation, everything should be under an umbrella routeapp-center
.It would really help if we could introduce a
BASE_PATH
config in the.env
and use that as the prependable route for every other route in the app.Steps to Reproduce the Problem
3000
port.3000
port based on a route-basedlocation
block (saylocation ^~ /app-center { }
).Expected Behavior
Buffalo app should work with all the URLs prepended with
app-center
in this case.Actual Behavior
The assets fail to load as the asset URLs are not constructed with
/app-center
prepended and hence NginX does not match the path.Even other routes fail similarly (Ex:
/users
has to become/app-center/users
).Info
The text was updated successfully, but these errors were encountered: