chore: simplify proxy config
This commit is contained in:
parent
12887d4b87
commit
129ad9ed10
@ -63,9 +63,7 @@ For example, if you are using Next.js, you can:
|
|||||||
```ts
|
```ts
|
||||||
import * as fal from '@fal-ai/serverless-client';
|
import * as fal from '@fal-ai/serverless-client';
|
||||||
fal.config({
|
fal.config({
|
||||||
requestMiddleware: fal.withProxy({
|
proxyUrl: '/api/fal/proxy',
|
||||||
targetUrl: '/api/fal/proxy',
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
4. Make sure your server has `FAL_KEY` as environment variable with a valid API Key. That's it! Now your client calls will route through your server proxy, so your credentials are protected.
|
4. Make sure your server has `FAL_KEY` as environment variable with a valid API Key. That's it! Now your client calls will route through your server proxy, so your credentials are protected.
|
||||||
|
|||||||
@ -6,10 +6,8 @@ import { useMemo, useState } from 'react';
|
|||||||
// @snippet:start(client.config)
|
// @snippet:start(client.config)
|
||||||
fal.config({
|
fal.config({
|
||||||
// credentials: 'FAL_KEY_ID:FAL_KEY_SECRET',
|
// credentials: 'FAL_KEY_ID:FAL_KEY_SECRET',
|
||||||
requestMiddleware: fal.withProxy({
|
proxyUrl: '/api/fal/proxy', // the built-int nextjs proxy
|
||||||
targetUrl: '/api/fal/proxy', // the built-int nextjs proxy
|
// proxyUrl: 'http://localhost:3333/api/fal/proxy', // or your own external proxy
|
||||||
// targetUrl: 'http://localhost:3333/api/fal/proxy', // or your own external proxy
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
// @snippet:end
|
// @snippet:end
|
||||||
|
|
||||||
|
|||||||
@ -5,9 +5,7 @@ import { useCallback, useMemo, useState } from 'react';
|
|||||||
|
|
||||||
fal.config({
|
fal.config({
|
||||||
// credentials: 'FAL_KEY_ID:FAL_KEY_SECRET',
|
// credentials: 'FAL_KEY_ID:FAL_KEY_SECRET',
|
||||||
requestMiddleware: fal.withProxy({
|
proxyUrl: '/api/fal/proxy',
|
||||||
targetUrl: '/api/fal/proxy',
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
type ErrorProps = {
|
type ErrorProps = {
|
||||||
|
|||||||
@ -3,10 +3,8 @@ import { useMemo, useState } from 'react';
|
|||||||
|
|
||||||
// @snippet:start(client.config)
|
// @snippet:start(client.config)
|
||||||
fal.config({
|
fal.config({
|
||||||
requestMiddleware: fal.withProxy({
|
proxyUrl: '/api/fal/proxy', // the built-int nextjs proxy
|
||||||
targetUrl: '/api/fal/proxy', // the built-int nextjs proxy
|
// proxyUrl: 'http://localhost:3333/api/fal/proxy', // or your own external proxy
|
||||||
// targetUrl: 'http://localhost:3333/api/fal/proxy', // or your own external proxy
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
// @snippet:end
|
// @snippet:end
|
||||||
|
|
||||||
|
|||||||
@ -68,9 +68,7 @@ Once you've set up the proxy, you can configure the client to use it:
|
|||||||
import * as fal from '@fal-ai/serverless-client';
|
import * as fal from '@fal-ai/serverless-client';
|
||||||
|
|
||||||
fal.config({
|
fal.config({
|
||||||
requestMiddleware: fal.withProxy({
|
proxyUrl: '/api/fal/proxy', // or https://my.app.com/api/fal/proxy
|
||||||
targetUrl: '/api/fal/proxy', // or https://my.app.com/api/fal/proxy
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user