Google API - Redirect URI with an internal IP - api

I'm creating an app using Google calendar API. Everything works fine on my local apache install, using localhost:8888/pathtoapp as the redirect URI.
I want to migrate the app to another machine on my local network. I tried changing the URI to the local ip of the new apache install. I get the following error...
Error: invalid_request
Invalid parameter value for redirect_uri: Raw IP addresses not allowed: http://192.168.0.17/pathtoapp/
Any ideas on how I can use an internal IP as a redirect URI or other ways around it?
Thanks.

Looks like the API is not allowing you to use IP addresses. Try to use network name not ip address.
If you don't have access to the name, create an alias on your local machine for that specific IP.

[development environment suitable solution]
Whilst the Google Console will not allow you to have an IP as a redirect URI:
Invalid Redirect: http://10.100.1.1 must end with a public top-level domain (such as .com or .org)
you can create a host name entry which redirect you a valid domain to another the desired IP address:
$ vim /etc/hosts
Append:
10.100.1.1 localhost.com www.localhost.com
Now you can access your site from localhost.com or www.localhost.com and have localhost.com as the redirect URI.

It's not possible...you have to stick in a domain name on a public server for testing...seems stupid to me as well :-P
Duplicate of this:
Can a public IP address be used as Google OAuth redirect URI?

Use localhost:port/redirectpath to test on local machine.

For window OS, this error can be removed by adding host entry in your system so google will think it as coming from the given hostname
Take your global IP address say: 106.200.247.101 (or google what is my IP, you will get it)
go to C:\Windows\System32\drivers\etc\hosts on windows and add a new entry as below
eg:
106.200.247.101 abc.com
Then you will be able to refer to using given hostname

Related

prevent user accessing site using server ip

My Apache Server IP address is 192.168.1.50 and the Domain Name is my.local. How do i restrict access to users using the IP address and not the server domain.
A user that uses the domain my.local can access the site, all files
should also be accessible.
A user that uses the server IP 192.168.1.50, should be redirected to the server domain, this being
my.local. So if that user went to 192.168.1.50/somepage.php they
would be redirected to my.local. If a user went to
192.168.1.50/images/someimage.jpg, they would be denied access.
How can this be achieved?
The most straightforward and flexible way is to create a separate virtual host with ServerName 192.168.1.50. Just don't create it as the first virtualhost for any port, as it would become the default.
You can then use all the basic directives to redirect or perform access control, all in the context of 192.168.1.50.

Cant access my website through its IP address

I have hosting with godaddy with a private IP address. I am able to access my websites and others via the domain name, but not via IP Address.
I am now trying to access the HTTP via port 80 but it gives an error that the website is not setup.
Are there any workarounds on turning allowing accessing the website and other folders through the IP address over http?
This sounds to me like you were on a managed webpack that grants you access to the to-be-served content but not to the webserver or its config itself.
What you are experiencing there is an effect of a technique called virtual-hosts in which multiple sites are tied to one IP address. For this to work in the realm of HTTP, the Host header got introduced in HTTP/1.1. It allows clients to send a domain name for which they want to receive content.
If you request a raw IP, though, the Host header won't look like Host: example.com but rather like Host: 123.45.67.89. The server will not be able to associate a domainname with this as it is unlikely to be found elsewhere in the request. Therefore, it will be forced to serve content out of its default document directory which usually contains further documentations regarding the further configuration of the webserver in question. Linux distributions like to add additional informations specific to them. Check if you see any mentioning of e.g. Debian, RedHat, or Centos.
I am not sure if this is fixable. Usually webservers like Apache support IP-based virtual hosts. If a masshoster like godaddy is really going to address this is uncertain. Try to contact their support and see.
1]If you are using host headers, make sure you have a DNS entry pointing your URL to your IP
2]Telnet port 80 from a machine outside your network.If it fails then check with your ISP that port 80 should not block in firewall.

website can be accessed using ip but not with the url(domain name) in wamp

from default httpd.conf to updating the host file and httpd.conf i tried but the website fails to open with domain name give
in host file
<my current public ip address> <domain name>
in httpd.conf
Listen [my public ip]:port
then restart of wamp server and finally restart of PC and of-course change of ip is done in above all.
But of no use
Please help
Thanks for time and response
Aaron,
I think you are misunderstanding the function of the HOSTS file.
The hosts file acts a little like a local DNS Server. Any changes you make to it will only effect the single PC that you made the change on.
What the HOST file actually does
When windows starts it starts a service called DNS Client also known as dnscache. That service reads the HOSTS file and seeds the dnscache with any domain names you put in it and the ip that should be connected to for each domain name.
Any program (the browser in this case) that wants to connect to a domain, checks this cache first, to reduce accesses to an actual DNS Server out on the web and therefore speed up the conversion of domain name to Ip Address.
So if you want external users, i.e. anybody on the internet to be able to access your site you have to either purchase a real domain name and get it pointed to your WAN ip address, or use a Dynamic DNS service like DYNDNS or NO-IP, to mention only a few, and get that dynamic dns service to point to your WAN IP.
You will also have to change your Apache config so it will serve that domain name, my suggestion would be to create a Virtual Host to do this.
This post may help with the process of creating a Virtual Host

IP address is shown in address bar instead of domain

I have a WAMP home web server up and running on a static IP and registered a domain with Namecheap, but I'm a bit shaky with DNS. At first I used URL Redirect and pointed it to my IP. This meant that when you typed in the domain (like example.com) it just redirected you right to my IP, replacing the domain name with it in the address bar. Now I'm trying to get the domain to show instead of the IP in the address bar, which I'm struggling to understand exactly how to do.
The latest thing I've tried which many people say to do is instead of using URL Redirect to use the A (Address) record type and point it to my IP, which I thought would finally fix my problems. Of course after 15 min or so when it all got updated I'm getting a 400 Bad Request with nginx under it in Firefox, and a blank page in Chrome. Now I'm getting blank pages in both. Did I do something wrong here? Do I need to edit something on the web server such as httpd.conf? Am I going at this completely wrong?
Yes you should do away with the redirect and instead create an "A record". The sub-domain entry would typically be, but is not restricted to "www". The record type "A" and destination/target would be your external IP address. Once you update this record it may take several hours before you notice it taking effecting, upon where on people typing your URL would be directed to your web server.
You will need to forward port 80 on your router to the server hosting WAMP.
Finally the WAMP server should be provided with your domain name so it knows which site to load. If use the VirtualHost file this will allow you to host multiple domains on your web server. To do this...
Uncomment the following line so it appears like below in your Apache httpd.conf, to allow Apache to use virutal hosts
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Then locate the httpd-vhosts.conf file, should be found in your WAMP installation location, such as C:\wamp\bin\apache\apache*version_number*\conf\extra\
Add an entry for your site, altering the details to your own domain name and website location.
<VirtualHost *:80>
ServerName www.stackoverflow.com
ServerAlias stackoverflow.com
DocumentRoot "C:/websites/stackoverflow/"
ErrorLog "C:/websites/stackoverflow/logs/error.log"
CustomLog "C:/websites/stackoverflow/logs/access.log" common
</VirtualHost>
Now restart your WAMP server and give it a whirl.
Tip: If your server won't start after these changes, check that you have created the folder structure for the log files!
Solution described here could resolve this issue.
Most of the free dynamic dns providers, allow acquiring more than one free host name. If allowed you can solve the problem by getting a second name, e.g., mysite2.somefree.org.
Now, go and configure your free domain names in the dashboard of free provider in the following way (assume your IP is 188.165.15.29 and your server's listening to port 8085).
redirect mysite1.somefree.org to mysite2.somefree.org:8085
redirect mysite2.somefree.org to your dynamic IP, say, to 188.165.15.29
This also works when you are using Apache httpd server alone, not being part of WAMP. You do not need to tweak virtual host or any part of your server. You only configure inbound direction.
Use Forward with masking where you registered your domain. mine is GoDaddy.
in the forward settings, you will see this at bottom of the page. click Forward with masking and add the title you want them to see in the address bar of the browser when they go to your site. instead of showing your IP address

Unable to determine IP address from host name

We have an iMac running as an internal dev server with Apache, PHP & Mysql.
It has a number of virtual host files and when accessing on the iMac, these work brilliantly.
We're also running Squid proxy server http://web.me.com/adg/squidman/ so that we can access the web through our connection when we're mobile.
General web browsing and such is fine when accessed via proxy, however when we try access a virtualhost url like ourtestsite.dev we get the following message:
Blockquote
he following error was encountered while trying to retrieve the URL: http://ourtestsite.dev/
Unable to determine IP address from host name "ourtestsite.dev"
The DNS server returned:
Name Error: The domain name does not exist.
This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct.
Your cache administrator is webmaster.
Can anyone shed any light on how we make these urls accessible via the proxy?
Thanks
within the network config on the iMac, I told it not to use the proxy for addresses that were *.dev
I had this working before with .local addresses but *.local is added as an exception automagically.
So adding the wildcard has solved and we're golden :-)
Just add an entry to the hosts file on your squid server pointing all the virtually hosted domains to the IP address of the iMac. This will bypass DNS lookups for those domains.