fix: Default to a relative path for the admin backend URL (#9947)
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/dashboard": patch
|
||||||
|
"@medusajs/framework": patch
|
||||||
|
"@medusajs/types": patch
|
||||||
|
"@medusajs/utils": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: Default to a relative path for backend URL in admin
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import Medusa from "@medusajs/js-sdk"
|
import Medusa from "@medusajs/js-sdk"
|
||||||
|
|
||||||
export const backendUrl = __BACKEND_URL__ ?? "http://localhost:9000"
|
export const backendUrl = __BACKEND_URL__ ?? "/"
|
||||||
|
|
||||||
export const sdk = new Medusa({
|
export const sdk = new Medusa({
|
||||||
baseUrl: backendUrl,
|
baseUrl: backendUrl,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { QueryClient } from "@tanstack/react-query"
|
import { QueryClient } from "@tanstack/react-query"
|
||||||
|
|
||||||
export const MEDUSA_BACKEND_URL = __BACKEND_URL__ ?? "http://localhost:9000"
|
export const MEDUSA_BACKEND_URL = __BACKEND_URL__ ?? "/"
|
||||||
|
|
||||||
export const queryClient = new QueryClient({
|
export const queryClient = new QueryClient({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export type AdminOptions = {
|
|||||||
*/
|
*/
|
||||||
outDir?: string
|
outDir?: string
|
||||||
/**
|
/**
|
||||||
* The URL of your Medusa application. This is useful to set when you deploy the Medusa application.
|
* The URL of your Medusa application. Defaults to the browser origin. This is useful to set when running the admin on a separate domain.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```ts title="medusa-config.ts"
|
* ```ts title="medusa-config.ts"
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export interface AdminOptions {
|
|||||||
*/
|
*/
|
||||||
path: `/${string}`
|
path: `/${string}`
|
||||||
/**
|
/**
|
||||||
* The URL of your Medusa application. This is useful to set when you deploy the Medusa application.
|
* The URL of your Medusa application. Defaults to the browser origin. This is useful to set when running the admin on a separate domain.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```js title="medusa-config.js"
|
* ```js title="medusa-config.js"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ describe("defineConfig", function () {
|
|||||||
expect(defineConfig()).toMatchInlineSnapshot(`
|
expect(defineConfig()).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"admin": {
|
"admin": {
|
||||||
"backendUrl": "http://localhost:9000",
|
"backendUrl": "/",
|
||||||
"path": "/app",
|
"path": "/app",
|
||||||
},
|
},
|
||||||
"featureFlags": {},
|
"featureFlags": {},
|
||||||
@@ -159,7 +159,7 @@ describe("defineConfig", function () {
|
|||||||
).toMatchInlineSnapshot(`
|
).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"admin": {
|
"admin": {
|
||||||
"backendUrl": "http://localhost:9000",
|
"backendUrl": "/",
|
||||||
"path": "/app",
|
"path": "/app",
|
||||||
},
|
},
|
||||||
"featureFlags": {},
|
"featureFlags": {},
|
||||||
@@ -318,7 +318,7 @@ describe("defineConfig", function () {
|
|||||||
).toMatchInlineSnapshot(`
|
).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"admin": {
|
"admin": {
|
||||||
"backendUrl": "http://localhost:9000",
|
"backendUrl": "/",
|
||||||
"path": "/app",
|
"path": "/app",
|
||||||
},
|
},
|
||||||
"featureFlags": {},
|
"featureFlags": {},
|
||||||
@@ -483,7 +483,7 @@ describe("defineConfig", function () {
|
|||||||
).toMatchInlineSnapshot(`
|
).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"admin": {
|
"admin": {
|
||||||
"backendUrl": "http://localhost:9000",
|
"backendUrl": "/",
|
||||||
"path": "/app",
|
"path": "/app",
|
||||||
},
|
},
|
||||||
"featureFlags": {},
|
"featureFlags": {},
|
||||||
@@ -644,7 +644,7 @@ describe("defineConfig", function () {
|
|||||||
).toMatchInlineSnapshot(`
|
).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"admin": {
|
"admin": {
|
||||||
"backendUrl": "http://localhost:9000",
|
"backendUrl": "/",
|
||||||
"path": "/app",
|
"path": "/app",
|
||||||
},
|
},
|
||||||
"featureFlags": {},
|
"featureFlags": {},
|
||||||
@@ -800,7 +800,7 @@ describe("defineConfig", function () {
|
|||||||
).toMatchInlineSnapshot(`
|
).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"admin": {
|
"admin": {
|
||||||
"backendUrl": "http://localhost:9000",
|
"backendUrl": "/",
|
||||||
"path": "/app",
|
"path": "/app",
|
||||||
},
|
},
|
||||||
"featureFlags": {},
|
"featureFlags": {},
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { normalizeImportPathWithSource } from "./normalize-import-path-with-sour
|
|||||||
import { resolveExports } from "./resolve-exports"
|
import { resolveExports } from "./resolve-exports"
|
||||||
|
|
||||||
const DEFAULT_SECRET = "supersecret"
|
const DEFAULT_SECRET = "supersecret"
|
||||||
const DEFAULT_ADMIN_URL = "http://localhost:9000"
|
const DEFAULT_ADMIN_URL = "/"
|
||||||
const DEFAULT_STORE_CORS = "http://localhost:8000"
|
const DEFAULT_STORE_CORS = "http://localhost:8000"
|
||||||
const DEFAULT_DATABASE_URL = "postgres://localhost/medusa-starter-default"
|
const DEFAULT_DATABASE_URL = "postgres://localhost/medusa-starter-default"
|
||||||
const DEFAULT_ADMIN_CORS =
|
const DEFAULT_ADMIN_CORS =
|
||||||
|
|||||||
Reference in New Issue
Block a user