POST-Request not working with "Reverse Proxy"?

Hello everyone, I have a REACT application that uses POST requests to communicate with a service in my application. For example, the following request is sent from the browser.

POST https://xyz.app.pantaris.io/r2mm/STOP_APP

With the following docker compose file (shortend to focus):

...

  rest2mqtt-mapper:
    build:
      context: .
      dockerfile: rest2mqtt-mapper/Dockerfile
    ports:
      - 8080:80

  ui:
    build:
      context: .
      dockerfile: ui/Dockerfile
    ports:
      - 3000:3000
    labels:
      - "com.calponia.networking.0.host=ui"
      - "com.calponia.networking.0.port=3000"
      - "com.calponia.networking.1.host=rest2mqtt-mapper"
      - "com.calponia.networking.1.port=80"
      - "com.calponia.networking.1.match.0.uri.prefix=/r2mm/"
      - "com.calponia.networking.1.match.0.ignoreUriCase=true"
      - "com.calponia.networking.1.rewrite.uri=/"


...

I was hoping that the request would be forwarded as follows.

http://rest2mqtt-mapper/STOP_APP

With Istio / Virtual Service I was not able to solve the problem.

Unfortunately, it seems that nothing is reaching the container. Instead, the browser receives a 404 error from istio. Any idea what I am doing wrong?

So far the UI is working fine with the exception that it cannot communicate with the backend. :smiley:

Thank you for your help.

Hi @michael.koerber2 and welcome to the forum.

Please try to toggle the order (index number) of your rules.

Find more information about that in the docs:

Note: All matches happen in order so if you would set "com.calponia.networking.1.port": 3000 to 0 it would match it first and all traffic would go to this service without ever matching all following definitions!

1 Like

Sometimes it is really easy. Thanks for your hint. Now it is running as expected. Thanks for your effort and time.

1 Like