Redirect with HTTP_AUTHORIZATION header - html

I have question about redirecting with HTTP_AUTHOZIATION header.
I have two apps:
Frontend Angular app
Ruby on Rails app
Is it possible to create a link in Angular app that redirects to Ruby on Rails html page with HTTP_AUTHORIZATION header and then read that HTTP_AUTHORIZATION header in rails?

You cannot create a direct link with authorization headers.
When you use $window.location.href the browser is making the HTTP request and not your JavaScript code.
You could use cookie via JavaScript and put your auth token there. this cookies will automatically be sent from the browser. However, you will want to review the security implications of using a cookie vs. a header.

Related

Can we use HTTP caching for navigation requests?

What is Navigation requests
Navigation requests are requests for HTML documents made by your browser whenever you enter a new URL in the navigation bar, or follow a link on a page taking you to a new URL.
Question
[1] I want to understand if I can use stale-while-revalidate cache-control header instead of using a service worker to cache my inital HTML page?
What have I tried?
I tried to test this using Fiddler (to change the response cache-control header), but it did not work for HTML request, though it worked for other resources like JS for some websites.
[2] Which makes me think if I have to change any other parameter also?
Didnt work for HTML request
It worked for JS files because we can see app.bundle was served from cache but was revalidated in background.

Create a link that can later be customized to different URL

I would like to create a link that I can customize later.
For example,
I create a href link in the footer of the website I developed for my client with the URL that forwards to my current Web design website.
In the future, if I have to change my Web design website URL I will just customize that footer link forward destination to another one without having to access the CPanel of my client's website.
Please tell me how is it possible to do. Is this possible to with any link shortener services?
The usual way to do this is to set up a redirect from your old site to your new, with a 301 status code. This is easily done with a simple configuration directive in your web server config.
I doubt if there is any link generator service that let you change the redirection link after generated.
If you will be able to access your previous url, link it with redirection page that will redirect client into your current url.
Or get a free domain that only works as redirection link.

Using S.browser_fallback_url in intent:// links to redirect to the app store using a market:// link

I am using an intent:// link to redirect users to an app, and hoping to use the S.browser_fallback_url field to redirect the users to the PlayStore if they do not have the app downloaded by setting the fallback url to be a market:// link with params added in.
Is the S.browser_fallback_url only capable of handling web links? as in, it wont work with market links?

Form Post HTTPS

I'm trying to submit a form back to my server using POST and the target is at the same domain (which is HTTPS) however when I submit I get a Mixed Content error. Does the form post not follow the same protocol as the hosting page? If so what is the best way to fix it without always specifying the full url (I use sub domains for different companies)
Does the form post not follow the same protocol as the hosting page?
It does if a relative URL is specified.
e.g. path relative
action="/form/foo"
or protocol relative
action="//example.com/form/foo"
It appears you have something on your action page, or the page that it redirects to loading over plain HTTP. Use developer tools to hunt out this reference.

Angular application, generated webpage and integration

I have a single page angular application with injected views and a generated webpage (pgBadger). My application make an http request to get the pgBadger html.
The thing is that I cannot inject this html since I am in a single page application (I cannot have the pgBadger page inside my angular page).
So I will need another page for pgBadger. I tried a link like this:
Unfortunately I have a token base authentication system on my Nodejs server, so
the response is Unauthorized. I usually add the appropriate header in my request through the angular http interceptors.
It looks like there is no property to add headers in either a or form tag.
I am stuck at the moment, any suggestions are very welcome.
Thanks for your help.