Skip to content

Here is an example of a proxy in node #673

Description

@dk253

Describe the feature you'd love to see

Howdy,

I just (finally) got this to work by setting up a proxy on my node express server. Here is the code if you want to add it to your readme (or if you want to correct me with a better way).

    app.use('/api', createProxyMiddleware({
        target: 'https://blah.remotetargetexample.com/api',
        onProxyRes: function (proxyRes, req, res) {
            proxyRes.headers['Access-Control-Allow-Origin'] = '*';
        },
        changeOrigin: true,
        pathRewrite: {
            [`^/api`]: '',
        },
    }));

Cheers!

Additional context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions