Facebook apps on a domain with URL forwarding and masking - facebook-javascript-sdk

I'm developing a web application with Facebook Javascript SDK on my server at http://example.com/webapp/. Now I registered a new domain name, say domain.com, with no hosting, and I forwarded with URL masking domain.com to example.com/webapp/, so the web app is still on my server at example.com/webapp/. I've tried to change app settings on Facebook, site domain to domain.com and website URL to domain.com, but the Javascript SDK doesn't work!
I think that the problem is that requests to facebook comes from my server at example.com and the app domain is domain.com. I notice that the JS SDK uses window.location to retrieve the url to be matched with the app domain and website url.. Is there a way to inject the redirect_uri parameter on every JS SDK functions call with the url of my redirecting domain domain.com?
Thanks to all in advice!

Instead of using URL Masking / Forwarding, you should see if you can use your domain domain.com pointing straight to example.com/webapp using Add-on Domains.
I.e. create a virtual host and have the new domain link to the actual files on the old domain name. Fowarding isn't the best way as some forwards use iframes or javascript to redirect.

Related

How make google Oauth login when there is different Domain Name used for front and backend

I am using the different domain names for the front and back end, I don't know configure the redirect Uri for the different domains in google console,
Example:
front-end: www.abc.com
backend: www.xyz.com

app.UseHttpsRedirection() is redirecting to "underlying" hostname not "request" hostname

Background
I have an Azure App Service hosted at myazurewebsite.azurewebsites.net.
The Azure App Service Startup class contains the line app.UseHttpsRedirection().
If I type http://myazurewebsite.azurewebsites.net into a browser, it redirects to https://myazurewebsite.azurewebsites.net - great!
I have DNS CNAME mydns.mycoolserver.com which references the above App Service.
If I type https://mydns.mycoolserver.com into a browser, then the browser shows my app service, and the address bar of the browser shows https://mydns.mycoolserver.com and all is good.
Problem
If I type http://mydns.mycoolserver.com into a browser, then the address bar of the browser shows https://myazurewebsite.azurewebsites.net.
So, it seems to me that the UseHttpsRedirection middleware has worked, but that it is redirecting to the "underlying" hostname, not the "original" hostname.
Note: in reality there is a Standard Akamai CDN in between myazurewebsite and mydns, so mydns is pointing to the CDN endpoint (myazurewebsite.azureedge.net) not the actual app service. Standard Akamai CDN doesn't have a rules engine so it isn't capable of doing http->https redirect, so I assume that it is the app.UseHttpsRedirection that is doing the redirect.
Anyway, in the above scenario, how can I get http://mydns.mycoolserver.com to redirect to https://mydns.mycoolserver.com?

External sites link https issue

I have a video website which I recently changed from http to https.
i.e http://example.com to https://www.example.com.
And I have also made an htaccess entry to automatically 301 redirect all http urls to https.
The old video embed code links given to external customer sites are like :
<script scr="http://example.com/embed_script.js"></script>
Some customer websites also changed to http to https. In those https websites the above link with http protocol won't work because of mixed content. I have no control over the customer sites to change those urls to https. Any automatic redirect solution exists for this ?
You can't fix this unless you get them to use https. You could perhaps locally cache a copy as a workaround, but I've never done that.

CDN for your entire site - when the origin server equals the supername

I am using a static site generator for my site, that means my entire site is static. All my resources and HTML files are referenced with the domain name prefixed, so that the CDN could be used.
But due to SEO concerns I disabled non-www access and redirect those to the www.domain.com variant. But now I cannot use a CDN apparently, because the origin server needs to be different from the supername.
Can a CDN be used for HTML files?
How can I deliver content through www.domain.com and use a CDN?
Can I give the CDN access to static.domain.com an an origin server, but deny access to other clients? Seems clumsy!
Any ideas?
Using Apache2.2 trying to use Level 3 CDN through my hosting company's site
depending what you are able to set on the CDN via your hosting company, the best way would be to override the host header on the CDN settings.
So, first let's look at your DNS settings:
www should point to the CDN
origin should point to your web server.
Now, on the CDN you set your origin to origin.yourdomain.com and add (I can't tell you if this is possible in your setup) a "http host header override" to www.yourdomain.com. In some cases it's implemented the other way around, so you would "force IP-Host" to origin.yourdomain.com.
In both cases, what you want to achieve is this:
when an end user requests www.yourdomain.com , it is resolved to the CDN
The CDN needs to fetch the content from your server, so it establishes a session on port 80 (assuming HTTP) to origin.yourdomain.com
Once the port is open, the CDN sends (amongst others) a HTTP Host-Header with www.yourdomain.com (this is the name based virtual host APache is seeing and evaluating).
That way you can set up your web server in exactly the same way as you would without a CDN.

Using a *.net domain as site URL or app domain

I'm trying to register an application so that I can implement log in with facebook on my site. The problem is that my domain ends with a .net hence I get an Error
App Domains: ****.net is not a valid domain.
Site URL is not a valid URL.
What could be the problem because when I use .com everything works fine.