could not proxy to https endpoint
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const lightCodeTheme = require('prism-react-renderer/themes/duotoneLight');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'TITLE',
tagline: 'The next build portal',
url: 'https://title.com',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'facebook', // Usually your GitHub org/user name.
projectName: 'title', // Usually your repo name.
plugins: [
[
'docusaurus-plugin-openapi',
{
id: 'core',
path: 'openapi.json',
routeBasePath: '/api/1.0/dev',
},
],
],
presets: [
[
'docusaurus-preset-openapi',
/** @type {import('docusaurus-preset-openapi').Options} */
({
api: {
path: 'openapi.json',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
proxy: {
'/': {
target: 'https://qa.title.com/api/1.0/dev',
},
},
}),
],
],
themeConfig:
/** @type {import('docusaurus-preset-openapi').ThemeConfig} */
({
colorMode: {
disableSwitch: true,
defaultMode: 'light',
},
navbar: {
title: 'Title',
logo: {
alt: 'My Site Logo',
src: 'img/logo.svg',
},
items: [{ to: '/api', label: 'API', position: 'left' }],
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
};
module.exports = config;
IS there anything that i am missing or doing wrong?
Looks okay to me, is there an error message or anything?
none, i am getting back the index,html file of the front end docusaurus site
localhost is working fine, i could proxy it, but not the https once i hosted it on firebase
Oh, was the Docusaurus site running in dev mode or a production build? (The proxy only works in dev mode, because it’s via webpack dev server)
how do i check that? i build it deployed it to firebase
If it’s built then it’s production
how do i proxy on the prod or on the dev ? i hosted my api on a https domain, now can i proxy request from the local machine?
If you set up CORS you shouldn’t need a proxy. If that isn’t an option you would need some sort of server to forward requests to the api
i have a cors enabled
can i put the build folder as a public asset and point that as my docusaurus? if so then what should i do about the proxy?
Yes, the build folder is intended to be the public assets. If CORS is enabled, you shouldn’t need a proxy, you can use the api url as the host and the request will go directly to it
can you give me a sample config file for that? right now i am missing something and i am not able to send requests to the live api domain from a deployed docusaurus site which is another domain
Can you share your openapi spec?
openapi: 3.0.0 info: version: "" title: title paths: { } servers:
- url: http://localhost:3001/proxy
Change url to https://qa.title.com/api/1.0/dev
remove proxy ?