Website Configuration on Google Cloud Storage without error pages - html

I have a single page application that I am (trying) to host on Google Cloud Storage.
The application is at index.html, and the application handles routing using Angular's html5Mode. (e.g.: routes like example.com/this and example.com/that are handled by the js application in index.html)
Using Google Cloud Storage's website configuration this is all well and good, except that routes that are accessed directly ("example.com/this") will 404 as they obviously do not map to a file.
I have set my 404 page to be my index page, but what I really need in order to run a single page application in html5Mode is that such routes ("example.com/this") will not return a 404 header - they will simply be handled by index.html and return a success header (200).
Is this possible?

Setting index.html to your 404 page from the website configuration seems to do the trick now.

Unfortunately, this isn't really possible. Google Cloud Storage's web mapping is pretty simple, and you can't create arbitrary rules based on patterns and the like.
You might want to consider either disabling html5mode or forcing a hashbang with html5mode. See this answer for more on that option.

Related

Most Streamlined Way to use Basic Authentication with Web Application and CDN

I have a site whose pre-production environments use HTTP basic authentication to prevent unauthorized access. Recently, we've added a CDN (AWS Cloudfront) and we intend to use basic authentication (FWIW, using Lambda#Edge) for those pre-production CDN environments, as well.
While we've already implemented basic authentication on the web application (we're able to access the site after authentication), and have rudimentarily implemented basic authentication on the CDN (we're able to, say, access an image directly, after authentication), we're having trouble combining the two.
The web application includes images in the normal ways (e.g., via HTML and CSS includes). For instance, my site, https://www.example.com, has the following in its HTML:
<img src="https://cdn-files.example.com/foob.png" />
Using Chrome, when hitting the web application, I get a double-challenge (one for the app's domain and one for the CDN, each in turn), and the image loads.
Using Firefox, I get a single challenge, and the page loads, but the image fails to load (that request's response is 401).
Question 1: (Most streamlined option.) Is it possible, through the right configuration settings, to get the browser to pass through the credentials from the app's domain to the CDN domain? If so, what configurations are needed?
If not:
Question 2: (Less streamlined: Double-challenge.) What's the right combination of configurations (presumably, headers, etc.) to get the images, etc., to load on the web app?
I would prefer not to embed the credentials in the URLs, if at all possible.

Azure website hiding .html extensions

Im hosting a couple of html files using an Azure website. I want to hide the .html file name extensions. I have been looking trough the site however i didnt find an options that works specifically with Azure websites.
You could use a URL Rewrite in the web.config file for an ASP.NET application to send a 404 or some other response for .html file requests.
Also, you could probably set up a custom HTTP handler mapping for .html extensions. That way a language processor could intercept those requests instead of just serving the file.

A good practice to set my custom domains on Heroku

Basically, Heroku gives you a domain named by default: XXX.herokuapp.com.
On my own, I have a set of REST apis that I would like to set on a domain named: api.myDomain.com.
On the same time, I have my HTML files (web view) distributed by the same server as the REST API.
It's similar to this; embedding static files on server in a dist folder.
I expect the domain serving those HTML/JS files to be www.myDomain.com.
I thought about putting them clearly on a distinct server dedicated to static files, but the fact is that Single Page Application should be controlled by a server, in order to make the refresh works (F5 redirecting to index.html), that's why I chose to use the same server as REST apis.
An alternative would be to dedicate ANOTHER server to treat only static files, independent of the REST Apis' server.
How to deal with both domains (api and www) while sources being on the same servers?
Or should I completely rethink the strategy?
You can just set both domains to direct to your page by setting it up in your app settings, but then I'm pretty sure that would mean api.myDomain.com/dist would show your static things, and www.myDomain.com could show your api things.
https://devcenter.heroku.com/articles/custom-domains
Another way you could do this might be by doing some things with your actual code, but we don't really know what your code is like right now.

Given URL is not allowed by the Application configuration. when using the Facebook Javascript SDK

Im currently using the Facebook Javascript SDK and I keep running into the following problem that appears in the console:
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
I've read a truck load of related posts but still can't get it to work. I am working locally using the following: http://localhost:8080/bookbayapp/. In my facebook developers app section I have the following:
But once again nothing seems to work. I am currently using Google Chrome for the testing and it is worth to mention that I am using the Facebook Plugin for Phonegap but when testing I comment out the link the to plugin js so I assume in doing this there shouldn't be any problems?
What works for me is using the actual URL of the production server, and then adding a line to the hosts file that redirects all traffic from that URL to localhost.
Let's say your website is called potatoes.com. In "Site URL" write:
http://potatoes.com/bookbayapp
and then open your hosts file (C:\Windows\System32\drivers\etc\hosts) and add the following line:
potatoes.com 127.0.0.1

Is there a way to deploy a custom .aspx page in the Reporting Services Pages folder?

I would like to deploy a custom page to the
..\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\Pages
folder.
But it seems that all requests except to the ReportViewer.aspx page are redirected to a directory browse.
Is there a way to register a custom page?
It may be possible, but I think the biggest hurdle is sorting out the Report Server vs. Everything Else configuration in IIS. If you haven't already, look into your configuration options with SSRS.
Configuring Reporting Services URL Reservations
URLs in Configuration Files
From what I have found, and its pretty ugly, the only way is to register your own handler(s) that overrides ReportViewerWebControl.axd. You can then read the request stream and make various changes as you need. Its not a nice solution and not highly supportable moving forwards with potential updates etc.
As an example I recently had the need to embed calls to ReportViewer.aspx in an application but support cross domain scripting, which was straight forward enough until you requested reports with date parameters and the calendar picker, which uses iframes etc for IE support. I managed to get round this with the handler approach.
I ended up simply replacing the OOB ReportViewer.aspx file with a custom one.