diff --git a/admin/next.config.js b/admin/next.config.js index 8a029e9..0898b94 100644 --- a/admin/next.config.js +++ b/admin/next.config.js @@ -6,8 +6,8 @@ module.exports = withCSS({ async rewrites() { return [ { - source: "/api/:path", - destination: "http://localhost:8080/api/:path", // Matched parameters can be used in the destination + source: "/api/:path/", + destination: "http://localhost:8080/api/:path/", }, ]; }, diff --git a/admin/src/lib/graphql.ts b/admin/src/lib/graphql.ts index ada1469..3863d71 100644 --- a/admin/src/lib/graphql.ts +++ b/admin/src/lib/graphql.ts @@ -8,7 +8,7 @@ function createApolloClient() { return new ApolloClient({ ssrMode: typeof window === "undefined", link: new HttpLink({ - uri: "/api/graphql", + uri: "/api/graphql/", }), cache: new InMemoryCache({ typePolicies: { diff --git a/cmd/hetty/main.go b/cmd/hetty/main.go index e329d76..7224cd8 100644 --- a/cmd/hetty/main.go +++ b/cmd/hetty/main.go @@ -81,11 +81,11 @@ func main() { hostname, _ := os.Hostname() host, _, _ := net.SplitHostPort(req.Host) return strings.EqualFold(host, hostname) || (req.Host == "hetty.proxy" || req.Host == "localhost:8080") - }).Subrouter() + }).Subrouter().StrictSlash(true) // GraphQL server. - adminRouter.Path("/api/playground").Handler(playground.Handler("GraphQL Playground", "/api/graphql")) - adminRouter.Path("/api/graphql").Handler(handler.NewDefaultServer(api.NewExecutableSchema(api.Config{Resolvers: &api.Resolver{ + adminRouter.Path("/api/playground/").Handler(playground.Handler("GraphQL Playground", "/api/graphql/")) + adminRouter.Path("/api/graphql/").Handler(handler.NewDefaultServer(api.NewExecutableSchema(api.Config{Resolvers: &api.Resolver{ RequestLogService: reqLogService, }})))