Senparc.Weixin + nginx configuration of the pit '10003 redirect_uri domain name and background inconsistencies'

No. sweep the micro-channel public functions Tip: 10003 redirect_uri domain name is inconsistent with the background

 

Senparc.Weixin components useful, but a pit, and do not know whether the two. .

 

First explain environment, centos + .net core 2.2

 

.netcore direct dotnet run, running with nohup, configure ports for 80, UseUrls ( "http: // *: 80"). Run command: nohup dotnet run &

The absence nginx configuration, everything is normal! ! ! !

 

 

  

Configure the port number after 8081 (UseUrls ( "http: // *: 8081")), then nginx configuration after forwarding, sporadic appearance: "10003 redirect_uri domain name and background inconsistent"

Configuration code is as follows:

    upstream changdao {
	server 127.0.0.1:8081;
    }

    server {
        listen 80;
        server_name changdao.xxxxx.org;
	location /{
		proxy_pass http://changdao;
	}
    }

  

 

 

After debugging, I discovered recently became the final callback

https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbb437396db00ae95&redirect_uri=http%3A%2F%2Fchangdao%2FPortalWeb

 

This value becomes the redirect_uri ,, becomes as follows.

http://changdao/PortalWeb

What is a ghost? ? ?

 

Look a bit familiar ah, it turned out to be nginx configuration ghost.

upstream changdao
 

 

With the idea of ​​change under the "upstream" name changed: changdao.xxxxx.org, configuration represents the following:

   upstream changdao.xxxxx.org {
	server 127.0.0.1:8081;
    }

    server {
        listen 80;
        server_name changdao.xxxxx.org;
	location /{
		proxy_pass http://changdao.xxxxx.org;
	}

  

After nginx configuration change, the configuration is with the following command to check whether the normal

/usr/local/nginx/sbin/nginx -t

 

 

Restart nginx:  

cd /usr/local/nginx/sbin/nginx

./nginx -s reload

 

 

Test again, the problem is solved

 

Guess you like

Origin www.cnblogs.com/jzb-dev/p/11117812.html