title: How to configure the url of a rest api container into another container which has Angular cli proxy
body: <p>I have Web application which is written in Angular 7 with proxy and .NET Core 2.2 as WebAPI. My problem is that locally everything works but I'm unable to make any request from WebAPI inside Codker container because I get</p>
  
  <pre class="lang-sh prettyprint-override"><code>craftsmen.client_1  | [HPM] Rewriting path from "/api//CraftOffer/GetManyWithFilters/0/5?category=0" to "/Public//CraftOffer/GetManyWithFilters/0/5?category=0"
  craftsmen.client_1  | [HPM] GET /api//CraftOffer/GetManyWithFilters/0/5?category=0 ~&gt; https://localhost:5000
  craftsmen.client_1  | [HPM] Rewriting path from "/api/CraftOffer/GetCategories" to "/Public/CraftOffer/GetCategories"
  craftsmen.client_1  | [HPM] GET /api/CraftOffer/GetCategories ~&gt; https://localhost:5000
  craftsmen.client_1  | [HPM] Error occurred while trying to proxy request /Public//CraftOffer/GetManyWithFilters/0/5?category=0 from localhost:4200 to https://localhost:5000 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
  craftsmen.client_1  | [HPM] Error occurred while trying to proxy request /Public/CraftOffer/GetCategories from localhost:4200 to https://localhost:5000 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
  </code></pre>
  
  <p>How to be able to make requests for WebAPI from client inside Docker container?</p>
  
  <p>I've tried:
  <br/>
  - change to change target inside <code>proxy.conf.json</code> into <code>https://craftsmen.webapi:5000</code>
  <br/>
  - changing <code>ASPNETCORE_URLS</code> from http into https
  <br/>
  - change to change target inside <code>proxy.conf.json</code> into <code>https://127.0.0.1:5000</code></p>
  
  <p><b>Current proxy.conf.json</b></p>
  
  <pre class="lang-js prettyprint-override"><code>{
      "/api/*": {
        "target": "https://localhost:5000",
        "secure": false,
        "logLevel": "debug",
        "changeOrigin": true,
        "pathRewrite": {"api" : "Public"}
      }
    }
  </code></pre>
  
  <p><b>Current Dockerfile for Angular app</b></p>
  
  <pre class="lang-sh prettyprint-override"><code># source https://mherman.org/blog/dockerizing-an-angular-app/
  # base image
  FROM node:12.2.0
  
  # install chrome for protractor tests
  RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
  RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" &gt;&gt; /etc/apt/sources.list.d/google.list'
  RUN apt-get update &amp;&amp; apt-get install -yq google-chrome-stable
  
  # set working directory
  WORKDIR /app
  
  # add `/app/node_modules/.bin` to $PATH
  ENV PATH /app/node_modules/.bin:$PATH
  
  # install and cache app dependencies
  COPY package.json /app/package.json
  RUN npm install
  RUN npm install -g @angular/cli@7.3.9
  
  # add app
  COPY . /app
  
  # start app
  CMD ng serve --host 0.0.0.0
  </code></pre>
  
  <p><b>docker-compose.yml</b></p>
  
  <pre class="lang-sh prettyprint-override"><code>version: '3'
  
  services:
    craftsmen.webapi:
      build:
        context: .
        dockerfile: BackEnd/src/Craftsmen.WebApi/Dockerfile
      ports:
        - "5000:5000"
      volumes:
        - webapi:/webapi
      networks:
        - craftsmenservices_network
    craftsmen.client:
      build:
        context: ./FrontEnd
        dockerfile: Dockerfile
      volumes:
        - 'FrontEnd:/app'
        - '/app/node_modules'
      ports:
        - '4200:4200'
      networks:
        - craftsmenservices_network
      depends_on:
        - craftsmen.webapi
      links:
        - craftsmen.webapi
    craftsmenservices_network:
      driver: bridge
  volumes:
    webapi:
    FrontEnd:
  </code></pre>
  
  <p><b>Current Dockerfile For WebApi</b></p>
  
  <pre class="lang-sh prettyprint-override"><code>FROM microsoft/dotnet:2.2-runtime AS base
  WORKDIR /app
  ENV ASPNETCORE_URLS https://*:5000
  
  FROM microsoft/dotnet:2.2-sdk AS build
  WORKDIR /src
  COPY BackEnd/src/Craftsmen.WebApi/Craftsmen.WebApi.csproj src/Craftsmen.WebApi/
  COPY BackEnd/src/Craftsmen.Infrastructure/Craftsmen.Infrastructure.csproj src/Craftsmen.Infrastructure/
  COPY BackEnd/src/Craftsmen.Core/Craftsmen.Core.csproj src/Craftsmen.Core/
  COPY BackEnd/src/Craftsmen.Contract/Craftsmen.Contract.csproj src/Craftsmen.Contract/
  COPY BackEnd/src/Craftsmen.Database/Craftsmen.Database.csproj src/Craftsmen.Database/
  RUN dotnet restore src/Craftsmen.WebApi/Craftsmen.WebApi.csproj
  COPY ./BackEnd .
  WORKDIR /src/src/Craftsmen.WebApi
  COPY BackEnd/src/Craftsmen.WebApi/entrypoint.sh .
  RUN dotnet build Craftsmen.WebApi.csproj -c Release -o /app
  RUN chmod +x ./entrypoint.sh
  CMD /bin/bash ./entrypoint.sh
  </code></pre>
  
  <p>I expect to be able to make succesfull requests from Angular Client to WebApi</p>