vercel / micro

Asynchronous HTTP microservices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nginx reverse proxy + docker. Request methods do not match

mishushakov opened this issue · comments

Hey, im running into issue here. I have created a micro-service, built it using docker and provisioned it with docker compose (together with Nginx reverse proxy on the same overlay network). For some unknown reason, when running behind a proxy, the req.method in the javascript does not match the actual request method. Here is a screenshot of what I'm talking about:

ilm-o7dhbw8

The first terminal is displaying micro-dev output, which i attached to the container (running on port 80)
The second terminal displays the nginx logs

In the background you can see the Postman client with "PUT" request method selected. But for some reason micro sees "GET" there :(

Here is my Nginx configuration file:

events {

}

http {
    server {
        listen 80 default_server;
        listen [::]:80 default_server;

        server_name _;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_redirect off;

        location /auth/ {
            proxy_pass http://auth;
        }
    }
}

However, when i have exposed the auth service to my host machine, I could do any of request methods, that my app supports. I will later try to run some other proxy software and see if it works.

Thank you.

Moved To Kubernetes & Traefik. Problem solved. Thank you again @zeit for creating the library

Best wishes.

Moved To Kubernetes & Traefik. Problem solved. Thank you again @zeit for creating the library

Best wishes.

Recently I am looking into Micro, I also went into this problem. Thanks! I will try it.