# Add and Remove Prefix

````json
{
    ...
    "servers": [
        {   
            "alias": "prefixing",
            "url": "https://sub.serverlessapigw.com/prefix/"
        },
        ...
    ],
    ...
    "paths": [
        {
            "method": "GET",
            "path": "/{.+}",
            "integration": {
                "type": "http_proxy",
                "server": "prefixing"
            }
        },
```
````

With the above configuration, any GET request to the API will be proxied to `'https://sub.serverlessapigw.com/prefix'`.

For example: `GET https://api.yourdomain.com/path` will be proxied to `GET https://sub.serverlessapigw.com/prefix/path`.

This method can also be used to remove a portion of the path from the beginning:

````
{
    ...
    "servers": [
        {   
            "alias": "prefixing",
            "url": "https://sub.serverlessapigw.com"
        },
        ...
    ],
    ...
    "paths": [
        {
            "method": "GET",
            "path": "/prefix/{.+}",
            "integration": {
                "type": "http_proxy",
                "server": "prefixing"
            }
        },
```
````

With this configuration, `GET https://api.yourdomain.com/prefix/path` will be proxied to `GET https://sub.serverlessapigw.com/path`.

### See Also

* [Paths](/configuration/paths.md) -- full reference for path-based routing configuration including methods, auth, and mappings.
* [Servers](/configuration/servers.md) -- define the upstream server aliases used in prefix-based routing.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.serverlessapigateway.com/configuration/add-and-remove-prefix.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
