1
0
mirror of https://github.com/raseels-repos/golang-saas-starter-kit.git synced 2025-12-24 00:01:31 +02:00

Fixed web-app redirects

This commit is contained in:
Lee Brown
2019-07-14 17:03:08 -08:00
parent 6188b05b2f
commit 8ae8c97af9
7 changed files with 142 additions and 69 deletions

View File

@@ -44,7 +44,6 @@ func (c *Check) Health(ctx context.Context, w http.ResponseWriter, r *http.Reque
// Ping validates the service is ready to accept requests.
func (c *Check) Ping(ctx context.Context, w http.ResponseWriter, r *http.Request, params map[string]string) error {
status := "pong"
return web.RespondText(ctx, w, status, http.StatusOK)

View File

@@ -79,7 +79,7 @@ func main() {
var cfg struct {
Env string `default:"dev" envconfig:"ENV"`
HTTP struct {
Host string `default:"0.0.0.0:3000" envconfig:"HOST"`
Host string `default:"0.0.0.0:3001" envconfig:"HOST"`
ReadTimeout time.Duration `default:"10s" envconfig:"READ_TIMEOUT"`
WriteTimeout time.Duration `default:"10s" envconfig:"WRITE_TIMEOUT"`
}
@@ -369,7 +369,7 @@ func main() {
var serviceMiddlewares []web.Middleware
// Init redirect middleware to ensure all requests go to the primary domain contained in the base URL.
if primaryServiceHost != "127.0.0.0" && primaryServiceHost != "localhost" {
if primaryServiceHost != "127.0.0.1" && primaryServiceHost != "localhost" {
redirect := mid.DomainNameRedirect(mid.DomainNameRedirectConfig{
RedirectConfig: mid.RedirectConfig{
Code: http.StatusMovedPermanently,