#365 Use relative urls in the browser to avoid needing to hardcode the domain name (#375)

* #365 Updated documentation for changing ports.  Updated the nuxt config to use separate internal and external api urls

* #365 Switch to using relative urls

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Don Benjamin
2024-04-15 15:02:28 +01:00
committed by GitHub
parent ae18bcbb8d
commit 75c2107b6c
4 changed files with 7 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
NUXT_LOG_LEVEL=
NUXT_PUBLIC_APP_URL=http://localhost/
NUXT_PUBLIC_API_BASE=http://localhost/api
NUXT_PUBLIC_APP_URL=/
NUXT_PUBLIC_API_BASE=/api
NUXT_PRIVATE_API_BASE=http://localhost/api
NUXT_PUBLIC_AI_FEATURES_ENABLED=false
NUXT_PUBLIC_AMPLITUDE_CODE=
NUXT_PUBLIC_CRISP_WEBSITE_ID=

View File

@@ -47,7 +47,7 @@ export function getOpnRequestsOptions(request, opts) {
addPasswordToFormRequest(request, opts)
addCustomDomainHeader(request, opts)
if (!opts.baseURL) opts.baseURL = config.public.apiBase
if (!opts.baseURL) opts.baseURL = config.privateApiBase || config.public.apiBase
return {
async onResponseError({response}) {

View File

@@ -25,4 +25,5 @@ export default {
* Used to authenticate that the requests are coming from the server - not from a client.
*/
apiSecret: process.env.NUXT_API_SECRET || '',
privateApiBase: process.env.NUXT_PRIVATE_API_BASE || null,
}