记录解决uni-app 用nginx反向代理出现Invalid Host header问题

君不见长松卧壑困风霜,时来屹立扶明堂。这篇文章主要讲述记录解决uni-app 用nginx反向代理出现Invalid Host header问题相关的知识,希望能为你提供帮助。
 

之前解决过一次,后来给忘记了,今天又遇到这个问题,现记录一下
修改uni-app的manifest.json文件  - 》源码视图

记录解决uni-app 用nginx反向代理出现Invalid Host header问题

文章图片

 
 
 
添加以下代码:
"disableHostCheck" : true //解决127.0.0.1指向其他域名时出现"Invalid Host header"问题


VUE项目遇到此问题也类似解决方案(因为uni-app  :一款基于vue的跨平台前端框架)
VUE工程解决方案参考:https://blog.csdn.net/Cookysurongbin/article/details/86077241
 
以下是我的nginx配置,仅供参考
#usernobody; worker_processes1; #error_loglogs/error.log; #error_loglogs/error.lognotice; #error_loglogs/error.loginfo; #pidlogs/nginx.pid; events { worker_connections1024; }http { includemime.types; default_typeapplication/octet-stream; #log_formatmain\'$remote_addr - $remote_user [$time_local] "$request" \' #\'$status $body_bytes_sent "$http_referer" \' #\'"$http_user_agent" "$http_x_forwarded_for"\'; #access_loglogs/access.logmain; sendfileon; #tcp_nopushon; #keepalive_timeout0; keepalive_timeout65; #gzipon; server { listen80; server_nametest.com; client_max_body_size1000m; location / { proxy_set_header Host $Host; proxy_set_header X-Forward-For $remote_addr; proxy_pass http://127.0.0.1:9090; }location /propese { proxy_set_header Host $Host; proxy_set_header X-Forward-For $remote_addr; proxy_pass http://127.0.0.1:9100/propese; }location /swagger { proxy_set_header Host $Host; proxy_set_header X-Forward-For $remote_addr; proxy_pass http://127.0.0.1:9100/swagger-ui.html; }error_page500 502 503 504/50x.html; location = /50x.html { roothtml; }} }


希望能帮助大家,更重要的是避免下次采坑!!!
【记录解决uni-app 用nginx反向代理出现Invalid Host header问题】 

    推荐阅读