The admins where I work have a url http://company.com/app, public facing. They use apache http server. The sysadmins have http://company.com/app pointing to http://internal_ip_address:8080. I have nginx sitting on http://internal_ip:address listening on 8080. I am trying to get nginx to take requests coming into internal_ip_address, route the requests to localhost:9000 which is a django app. Once django is done with the request the resulting page renders with appropriate public facing url (e.g. http://company.com/app . . .) Thanks for any help!
Thanks to all those that tried to help. After spending a notable amount of time on the issue I determined that it was a http server config issue on a server managed elsewhere.
Related
I have a react project deployed inside an nginx docker container which is deployed on k8s which is on AWS.
I have a backend service which is deployed also on aws and I have a url to access it. It can be accessed directly on browser, on postman or my react app if I remove the proxy pass for this url, but I need the proxy pass to solve other issues.
It was working at the beginning and stopped working and I got 504, after trying every related solution from stack overflow, now I get 502 instead. And backend shows that nginx could never reach this backend.
There are many other backend Urls being used exactly the same way, and they are totally fine, it is just this one url which is not accessible.
I also have a local nginx running which never gives me issue on this backend Url, but even if I redeploy the react nginx server on aws and redeploy that backend service, it is still giving me 502. Any one have opinion on this weird issue?
Thank you for taking a look.
I tried every possible and related config for the locaton of this url in conf file. But none of them worked
Scenario -
Someone is requesting a url served by a Django app. His IP is 3.3.3.3 . It could be a client but could be a server too, I don't know at the time of the request.
In project settings file, there is
ALLOWED_HOSTS = ["1.1.1.1", "2.2.2.2"]
He (3.3.3.3) is still served. What are the allowed hosts for then?
Dear StackOverflow community, your help would be greatly appreciated.
I have zero experience with IIS. Unfortunately, a Windows Server 2012 with IIS 8.5 is all I can get for the current project. I followed this post by Matt Woodward to get my Django app running on IIS. I serve static files by means of an application that references the static folder. The app looks the way it is supposed to look and all GET requests are processed properly. However, the response to all POST requests (on localhost and remotely) is Status 500 Server Error. If I run my Django app with the runserver command, the POST requests are processed properly.
POST is NOT blocked in IIS Request Filtering -> HTTP Verbs. POST requests are sent to URLs like http:/site_title/update_plan/, not to html. The StackOverflow posts found here and here were not helpful.
I suspect the problem is in the IIS settings, but maybe some special Django settings are required and I am missing it. Any ideas on what can be done to fix the problem would be of great help. Thanks!
Here is my setup.
Public site hosted by squarespace.com (www.example-domain.com)
Web application (AWS EC2/ELB), i would like to be available via the same domain. (my.example-domain.com)
Custom profile pages available as www.example-domain.com/username
My question is how can i setup the DNS to achieve this? If can't do it just through DNS, any suggestions? The problem i am facing is that if squarespace.com is handling the www.example-domain.com traffic how can i have it only partially handle it for certain urls. Maybe i am going about this in the wrong was all together though.
The two first are ok. As you mention, (1) is not compatible with (3) for a pure DNS config as www of example-domain.com has to be configured to a single end-point.
Some ideas of non-DNS workaround:
Having the squarespace.com domain on sqsp.example-domain.com and configure your www domain to a custom web server on which you configure the root (/) to redirect (HTTP 300) to sqsp.example-domain.com. It will be quite transparent for the user, except in his browser address.
The same but setting on / a full page HTML iframe containing sqsp.example-domain.com.
The iframe approach is a "less clean", Google the solutions to build your opinion.
EDIT:
As #mike-ryan mentioned, there is the proxy solution as well where you configure you web server to request another server to get the content to return to your user. If you are already using AWS, a smart way to do this is to use CloudFront: you can setup CloudFront to proxy one server on one URL and proxy another server on other URL. Actually, this is maybe the faster to way to implement you need. Of course, a proxy is one more "hop", so it may add more delay.
If you really want to have content served from different servers while only using a single domain name, you'll need to set up a proxy server to handle the request routing for you. I am assuming your custom profile pages must be served from your EC2 instance.
Nginx will receive all requests, and will then decide whether they should be sent to Square Space or your web app. Requests will be reverse proxied to Square Space or to your app, depending on the URL.
This is similar to #smad's answer, except it will all be invisible to the users which IMHO is better than redirecting the user to a new domain name.
Example steps:
Set up an Nginx server, create two virtual hosts - one for my.example.com, and one for www.example.com
Create two upstreams in your Nginx config - one for Square Space, and one for your app
Configure the www.example.com virtual host to reverse proxy connections to the Square Space upstream, if the URL is "/". Otherwise, traffic should be proxied to your app upstream [0]
Configure the my.example.com virtual host to proxy all traffic to your app upstream
[0] how to reverse proxy via nginx a specific url?
I have two sites that share the same problem, they are both hosted on Amazon EC2.
The machines are Debian 6.0, with an nginx server in front serving media, and proxying to apache+mod_wsgi to serve django.
Normal navigation on the site works fine, but whenever I click on a link without a trailing slash, or I submit a form, instead of redirecting me to www.domain.com/path/to/page/ I will be shown ip-11-111-11-111/path/to/page/, with ip-11-111-11-111 being my AWS internal IP address. The forms/links are working as the python code is executed, but when the templates are called, the url is 'built' wrong. Setting APPEND_SLASH = True doesn't fix it, and the same behaviour happens with the admin site, so I suspect it is some general issue rather than a bug in my code.
Has anybody encountered this problem? Any suggestions on how to solve it?
I've been googling this for weeks now and still can't figure it out, any ideas on where I should be looking would be appreciated as well.
In case anybody else has the same problem, the issue was apache redirecting non-www sites to the address it was listening on, which was the internal ip. I fixed it by forcing www. in nginx so that apache will never need to redirect.