Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(react): add proxy config support to file-server executor #9225

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,5 +1,5 @@
import { exec, execSync } from 'child_process';
import { ExecutorContext, joinPathFragments, logger } from '@nrwl/devkit';
import { ExecutorContext, joinPathFragments } from '@nrwl/devkit';
import ignore from 'ignore';
import { readFileSync } from 'fs';
import { Schema } from './schema';
austinhappel marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -26,6 +26,12 @@ function getHttpServerArgs(options: Schema) {
if (options.proxyUrl) {
args.push(`-P ${options.proxyUrl}`);
}

if (options.proxyOptions) {
Object.keys(options.proxyOptions).forEach((key) => {
args.push(`--proxy-options.${key}`, options.proxyOptions[key]);
});
}
return args;
}

Expand Down
1 change: 1 addition & 0 deletions packages/web/src/executors/file-server/schema.d.ts
Expand Up @@ -9,4 +9,5 @@ export interface Schema {
parallel: boolean;
maxParallel?: number;
withDeps: boolean;
proxyOptions?: object;
}
12 changes: 12 additions & 0 deletions packages/web/src/executors/file-server/schema.json
Expand Up @@ -49,6 +49,18 @@
"proxyUrl": {
"type": "string",
"description": "URL to proxy unhandled requests to."
},
"proxyOptions": {
"type": "object",
"description": "Options for the proxy used by http-server",
"default": {},
"properties": {
"secure": {
"type": "boolean",
"default": false
}
},
"additionalProperties": true
}
},
"additionalProperties": false,
Expand Down