feat: add --base-path cli arg which allows setting a custom route prefix
depends on
MODIFY
docs/en/writing-running-appium/server-args.md
docs/en/writing-running-appium/server-args.md
@@ -18,6 +18,7 @@ All flags are optional, but some are required in conjunction with certain others
|`--ipa`|null|(IOS-only) abs path to compiled .ipa file|`--ipa /abs/path/to/my.ipa`|
|`-a`, `--address`|0.0.0.0|IP Address to listen on|`--address 0.0.0.0`|
|`-p`, `--port`|4723|port to listen on|`--port 4723`|
+|`-pa`, `--base-path`|/wd/hub|Initial path segment where the Appium/WebDriver API will be hosted. Every endpoint will be behind this segment.|`--base-path /my/path/prefix`|
|`-ca`, `--callback-address`|null|callback IP Address (default: same as --address)|`--callback-address 127.0.0.1`|
|`-cp`, `--callback-port`|null|callback port (default: same as port)|`--callback-port 4723`|
|`-bp`, `--bootstrap-port`|4724|(Android-only) port to use on device to talk to Appium|`--bootstrap-port 4724`|

MODIFY
lib/main.js
lib/main.js
@@ -119,7 +119,8 @@ async function main (args = null) {
routeConfiguringFunction,
port: args.port,
hostname: args.address,
- allowCors: args.allowCors
+ allowCors: args.allowCors,
+ basePath: args.basePath,
});
if (args.allowCors) {
logger.warn('You have enabled CORS requests from any host. Be careful not ' +

MODIFY
lib/parser.js
lib/parser.js
@@ -3,6 +3,7 @@ import path from 'path';
import _ from 'lodash';
import { ArgumentParser } from 'argparse';
import { rootDir } from './utils';
+import { DEFAULT_BASE_PATH } from 'appium-base-driver';
const args = [
[['--shell'], {
@@ -56,6 +57,15 @@ const args = [
dest: 'port',
}],
+ [['-pa', '--base-path'], {
+ required: false,
+ defaultValue: DEFAULT_BASE_PATH,
+ dest: 'basePath',
+ example: '/path/prefix',
+ help: 'Base path to use as the prefix for all webdriver routes running' +
+ `on this server (default: ${DEFAULT_BASE_PATH})`
+ }],
+
[['-ca', '--callback-address'], {
required: false,
dest: 'callbackAddress',

feat: add --base-path cli arg which allows setting a custom route prefix (#13079)

depends on https://github.com/appium/appium-base-driver/pull/346