# Flask app custom domain issue with base path

**URL:** <https://forum.serverless.com/t/flask-app-custom-domain-issue-with-base-path/9788>\
**Category:** Serverless Framework\
**Tags:** aws, api-gateway\
**Created:** [November 7, 2019, 12:30pm UTC](https://forum.serverless.com/t/flask-app-custom-domain-issue-with-base-path/9788 "2019-11-07T12:30:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eminsaral](https://avatars.discourse-cdn.com/v4/letter/e/ecd19e/32.png) [@eminsaral](https://forum.serverless.com/u/eminsaral)\
**Post date:** [November 7, 2019, 12:30pm UTC](https://forum.serverless.com/t/flask-app-custom-domain-issue-with-base-path/9788/1 "2019-11-07T12:30:37Z")

</div>

Hello,

After following the directions on [this](https://serverless.com/blog/api-gateway-multiple-services/) custom domain article, I was able to setup custom domain for my flask service which I created by following this article: [https://serverless.com/blog/flask-python-rest-api-serverless-lambda-dynamodb/](https://serverless.com/blog/flask-python-rest-api-serverless-lambda-dynamodb/)

My serverless.yml is as following:

```
service: fleet-api
app: fleet-api

plugins:
  - serverless-python-requirements
  - serverless-wsgi
  - serverless-domain-manager

provider:
  name: aws
  runtime: python3.6
  stage: dev
  region: eu-central-1
  environment:
    SERVICE_NAME: ${self:service}

functions:
  app:
    handler: wsgi_handler.handler
    events:
      - http: 'GET /'
      - http: 'GET /users'

custom:
  stage: ${opt:stage, self:provider.stage}
  wsgi:
    app: main.app
    packRequirements: false
  pythonRequirements:
    dockerizePip: non-linux
  domains:
    prod: api.mydomain.com
    dev: staging-api.mydomain.com
  customDomain:
    domainName: ${self:custom.domains.${self:custom.stage}}
    basePath: 'fleet'
    stage: ${self:provider.stage}
    createRoute53Record: true

```

When I leave basePath empty instead of ‘fleet’, I am able to get results from my endpoints but when I wanna fill it with `fleet`, I get the following response:

```
# Not Found

The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. 

```

Any idea what’s wrong in my setup?

---

<div class="post-metadata">

**Author:** ![hoang-innomizetech](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/hoang-innomizetech/32/3744_2.png) [@hoang-innomizetech](https://forum.serverless.com/u/hoang-innomizetech)\
**Post date:** [November 8, 2019, 6:19am UTC](https://forum.serverless.com/t/flask-app-custom-domain-issue-with-base-path/9788/2 "2019-11-08T06:19:51Z")

</div>

According to the [serverless-wsgi](https://github.com/logandk/serverless-wsgi) document, you have to set the API\_GATEWAY\_BASE\_PATH environment variable as _fleet_

```auto
provider:
  name: aws
  runtime: python3.6
  stage: dev
  region: eu-central-1
  environment:
    SERVICE_NAME: ${self:service}
    API_GATEWAY_BASE_PATH: fleet

```
