HTTP POST降到港口网址 [英] Http POST drops port in URL

查看:112
本文介绍了HTTP POST降到港口网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Django的内置web应用程序。我目前在家里路由器后面运行它关闭一台笔记本电脑。

I have a webapp built with Django. I'm currently running it off a laptop at home behind a router.

我必须配置为路由发送至特定端口的笔记本电脑的所有流量路由器。

I have the router configured to route all traffic sent to a specific port to that laptop.

我的Nginx作为Apache的反向代理,使用mod_wsgi的运行Django的。

I have Nginx as a reverse proxy for Apache, using mod_wsgi to run Django.

我的问题是这样的:当我尝试提交任何POST表单,港口#会从该网址中删除(例如209.245.23.201:1552/login/成为209.245.23.201/login /)

My problem is this: when I try to submit any POST form, the port # gets removed from the url (e.g. 209.245.23.201:1552/login/ becomes 209.245.23.201/login/)

自然地,这打破。是什么原因导致这(Nginx的,Apache的,Django的?),我该如何解决这个问题?

Naturally, this breaks. What causes this (Nginx, Apache, Django?) and how can I fix it?

先谢谢了。

编辑:看来,形式确实要提交,但我认为重定向失败

It appears that the forms DO submit, but I think the redirect fails.

编辑2:问题肯定要么Nginx的,或Nginx的和Apache之间的相互作用。我试图与Apache的安装作为唯一的服务器,运行Django,它工作得很好。因此,无论是Nginx的下降端口,或以某种方式Apache是​​过得去的Nginx充当proxy.whatever混淆

EDIT 2: The problem is definitely either with Nginx, or the interaction between Nginx and Apache. I tried the setup with Apache as the only server, running django, and it worked fine. So either Nginx is dropping the port, or somehow Apache is getting confused by Nginx acting as the proxy.whatever

推荐答案

我有我的开发服务器同样的问题。
一些互联网搜索之后,我发现这个讨论( Nginx的,Apache和奇管理员误差)其中的解决办法是修改Nginx的代理配置。

I have the same problem with my development server. After some internet search I've found this discussion (nginx, apache, and odd admin error) where the solution is to modify the proxy configuration of nginx.

配置设置修改为:

proxy_set_header            Host $host;

解决方案是增加的端口号:

the solution is to add the port number:

proxy_set_header            Host $host:$server_port;

在我ngnix +的Apache2(与工人MPM)+ Django的,现在一切运作良好。

In my ngnix + apache2 (with worker mpm) + django now all works well.

这篇关于HTTP POST降到港口网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆