How to redirect some ip's in django - django

I thought I stumbled on an answer to this question but now I cannot find it. I am looking to redirect some ip's in my production environment so that all ip's that are not mine will direct to a coming soon type of page.
Any ideas of how to make this happen?
Using nginx/gunicorn just in case it has to be done on that end.

Related

Deceptive site ahead google chrome when i tried to open the ngrok url

recently I came across this issue when I exposed my port via ngRok.
I simply forwarded it but when I tried to open the ngRok url I got Deceptive site ahead warning.
Here is the image of the warning.
It was a django server with graphql and I wanted to test graphiql. (this point might not be necessary for the reader but more info is always better than no info)
So the solution I found was to click on the red empty area and type "thisisunsafe" (without quotes of-course)
PS: I searched for the solution but couldn't find any I hope this will help others who are looking for the same.
Another workaround that I found is using that same URL in an incognito window. I'm not sure why the security is more lax there...but it works.

WordPress blog in Subdirectory of Django website on a CPanel Host

As I read articles and questions online, I believe it is possible; My main question is how to achieve this goal?
I have Django Website with some urls on my domain (I use Setup Python App plugin on CPanel). I can simply achieve this using a subdomain, but I want to run my WordPress blog on a subdirectory, but every url that is not registered in urls.py will raise an error.
What's the best way to reach this goal?
What are the steps that I need to take to reach it?
I will be more than greatful if you point me towards the right direction.
Thanks in advance.

In the context of using ContentBox CMS, where does cb.siteBaseURL get the base url from?

I am running ContentBox on Lucee using CommandBox. In my ContentBox Admin, when I first set it up, I had it running on 127.0.0.1. Later, I created a web.config and updated the host file to use mydomain.com (I am using mydomain.com here as an example. The actual domain name is different). I have restarted the server a few times and even re-initiated a few times. However, cb.siteBaseURL keeps returning 127.0.0.1. My question is, where is cb.siteBaseURL getting the URL from? While I might have overlooked, but I have looked at every field in both Settings and Geek Settings and I don't see anything that have to do with the base URL.
NOTE: I wish I could tag ContentBox. However, it does not currently have a ContentBox tag. To create a new tag, I need 1500 reputation, which I don't have. So, Lucee, CommandBox, and ColdBox are the best ones I can come up with
First of all, we have a dedicated community forum for ContentBox here: https://community.ortussolutions.com/c/communities/contentbox/15
The issue you are experiencing is because ContentBox is multi-site. So each potential host needs to be mapped to the domain in question. Each site has a base url that you must define in order to build links and execute things. So when you install ContentBox, we have no clue which domain you will attach it to, so it defaults to the 127 ip address.
So now that you have a domain, just go to the Sites and update the base url to your domain.

Accessing wildcard page in flask by naked domain from phone redirects to searchvity.com

Hi I'm new at domains and registrars and just stumbled upon a really weird behaviour that I don't know how to tackle.
I built a website with flask (hosted in PythonAnywhere, with domain.com as my registrar). I set things up at domain.com so that the naked domain redirects to the www. version, and it works well for any page in the site that I've defined specifically in my flask like #app.route('/something/').
I had to tweak things a bit so that the naked domain also accepts them without the last slash, like this...
#app.route('/something/')
#app.route('/something')
def something()
# actual code
...but, when I try to access a page that doesn't exist through the naked domain, on computer it doesn't work (404 error, doesn't even show a simple html page) and on my phone it shows a weird random page that after gossiping a bit I realized is by searchvity.com. And I mean, I have absolutely no clue about how on earth that's possible.
Also, the weirdest part of all this is I actually have a route in flask that should manage this (#app.route('/<randomurl>/'), also with and without slash), but as said, that only works when accessing the www. version of the domain.
I know it's kinda a minor issue (since why would anyone try to access on purpose a page that doesn't exist specifically in the naked domain). But it bothers me quite a bit that someone could be redirected to that random site if the conditions are given and they are comming from phone... and in any case it's an issue that shouldn't be there and I don't even know where to start in order to fix it.
EDIT: now apparently the desktop version also shows that same weird page.
EDIT2: The reason I had only 404 on my desktop and not the weird (DNS spoofing?) page was AdBlock.
EDIT3: When the issue happens, the server at pythonanywhere doesn't even see the access data (it's like nothing happened).
Finally I found NakedSSL, which lets you redirect people from your naked domain towards the https version.
I got to add a free SSL certificate on my pythonanywhere page (which is as easy as two clicks), and then on NakedSSL everything is quite straight forward too.
Now I get the proper pages in all the cases (404, wildcard, etc) and there are no more weird spoofing things.

How to keep the root Rails 4 app from accepting subdomains?

When I originally wrote the API for my website, I wanted to have it as a subdomain like so: api.example.com. That worked. Now I am changing it so api can only work when trying to access it as part of the URLL example.com/api/.... Now this works except locally api.example.com/api... works still. More interesting is the fact that some random subdomain does not work. On the production site though any subdomain works, which is not what I want. Is there a way to ensure that subdomains aren't caught by the root in Rails 4?
As an extra question that hopefully is answered, but doesn't have to be, how can I redirect to another subdomain using the routes. I haven't been able to figure it out and I am wondering if it is possible.