Displaying remote URL - html

First I must explain I am a total newbie with regards to web design.
My question is as follows:
I would like to have a remote URL displayed through a different web server. The remote URL resides on an internal firewalled server and I would like to give public access to a single page by displaying it on a remote web server that has access to the firewalled page. I have tried iframes but they use the clients IP which results in the page failing to display. I have limited access to the server (CPanel) - please advise how this is possible? The remote URL will be requiring a login - not sure if this will have relevance on the solution.

What you can do is create a page which makes a request to the firewalled page using either CURL or HttpWebRequest or any compatible technology based on the platform you have chosen. It can then trim out the headers and other tags which are not required and render the html in a div, or it can just redirect the entire code in the response of your page.
This way, there will be no connection made from the client end, just your server will connect to your firewalled server and fetch the page from there and in turn give it back.
The only problem here is, forms - images and linked objects might not work properly, you might also have to parse them and replace the respective urls to point to your server which in turn proxyfy it.
Here is an example of it
https://proxify.net/

Related

Http redirect for content on relative paths

Essentially what my use case is, a 3rd party server only support POST on a specific integration url. but I want a browser to hit it from a normal html link (I have no control over either systems code, I can only configure the destination url for the link)
To solve or this I have written a web hosted app (done in Mirth Connect - but the server tech in theory shouldn't matter). The objective of my app is to cat the GET and convert it to a POST
My systems logic:
My web server receives an HTTP GET from a browser, grabs the query strings.
The server then performs an HTTP POST on a 3rd party server, and grabs the html result
The server then returns the original html and delivers it as the result to the original http request from the browser
This works great, the issue comes in with content hosted on the 3rd party server that is referenced with a relative path (css, js, images, etc).
Because I have "tricked" the browser into thinking it received the html from my system, it looks on my server for the content (which will all 404).
Without having to handle the fetching of all the content myself, is there a way to tell a browser to redirect all further queries to the 3rd party server?
I tried making my HTTP GET return a status 301 or 302 with the location being the base address of the 3rd party server, but this obviously tells the browser to redirect completely
Figured it out.
I just had to intercept the html and inject a BASE tag .

How can I display an image from a file server with HTML

I have a website that displays a lot of messages and images, usually through normal HTML tags. We now have a file server where we would like it to be our one stop place to retrieve files and images.
I can create links that allow me to download files from the server but I can't find anyway of displaying the images on the web pages.
To clarify a bit more, our web page is running through a server we'll call SERVER1, and we used to just retreive our files from that server. Now we are still running the website through SERVER1 but want to display images from a different server named FILESERVER.
links like
http://SERVER1/imagedocs/image.jpg used to work but
http://FILESERVER/imagedocs/image.jpg doesn't work
while
file://FILESERVER/imagedocs/image.jpg does work but I believe this is because I have a local connection to the server and will not work if I apply it to the website.
Any clues on what I should be looking for as a solution.
the file:\\ means it's a local file opened by your browser.
There might be various reasons why you can't access stuff that are currently on your server. I will take as granted that the file is actually on your second server, and you havent made a typo ( you can still double check it though, double check the filepath too (( maybe it was ROOT/dir/image.jpg and now it's ROOT/image.jpg)) ). Do you know if your 2nd server is blocking connections perhaps ? Have you succesfully connected to it? i'd suggest you to ping your server adress to see if you got a response, if it does ping, we going to need more infos about the way your server have been set up.

Issues with images, security and cache

I've got some issues regarding images and secure access to the cloud (S3, in this case).
I do want to have direct access to avoid stressing my server so I do have two options:
1.) Generate a signed url on my server and send it back to client to load from
2.) Generate an Authorization-Header sent within the request from the client
Now, 1. & 2. work just fine, however, I am in trouble regarding images in html.
For 1.), images will be re-requested each time as the url changes every time and thus renders caching useless.
For 2.), caching would work as the url'd stay constant though I've seeked the net to figure how to add a custom http request header to image request including my security token without luck.
So, what options are left for me? How do others resolve that issue?
thanks
Alex

cross domain rest dojo call

I have to load data for a different url the page will run on the android browser and will load content from remote server .
I have to use dojo so I tried with dojo.xhrGet , it does'nt load the data so when I red the reference guide I saw that that method has some limitation with external url's .
So what I have to do now if I have to call a REST service with dojo .
the REST service URL on the remote server:
http://192.168.1.65:9080/RAD8JAX-RSWeb/jaxrs/customers/accounts/111-11-1111/
and the data that I should see
[{"id":"001-111001","balance":12345.67},{"id":"001-111002","balance":6543.21},{"id":"001-111003","balance":98.76}]
please help me with a method that can fix my problem I dont know dojo well I'm blocked right now because I can't use the data between two application they can't communicate
Your question is unclear, but I think you are saying you want to load data from a different domain to the main web page.
You cannot reliably use AJAX to load data from anywhere other than the domain of page you are visiting.
Almost all modern internet browsers deliberately block that, for the protection of their own users.
Instead, you will need to find some way of getting your server to relay the information.
So imagine currently you do:
Load page a.example.com/index.html
Page uses dojo to try to load b.example.com/data
You would instead need to do:
Load page a.example.com/index.html
Page uses dojo to try to load a.example.com/data
When the a.example.com server receives a request to load /data, it should connect (perhaps using cURL) to b.example.com/data and then output the same text.

Apache and HTML, post requests and actions - does an absolute URL leading to the same server get parsed as a local URL?

Not 100% sure if this is the right SE site to ask this, so feel free to move/warn me.
If I have a site www.mysite.com with a form on it and define its action as "http://www.mysite.com/handlepost" instead of "/handlepost", does it still get parsed as a local address by apache? That is, will apache figure out that I'm trying to send my form data to the same server the form resides on and do an automatic local post, or will the data be forced to make a round trip, going online, looking up the domain and actually being sent as an outside request?
Apache does not look at this information. It's your browser which does this job.
On the Apache side the job is only outputing content (html in this case), apache does not care about the way you write your url in this content.
On the browser side the page is analysed and GET requests (images,etc) are sent automatically to all collected url. The browser SHOULD know that relative url /foo are in fact http://currentsite/foo - or it's a really dump browser -. It is his job. And then it's his job to push the request to the right server (and to known if he should make a new DNS request, build a new HTTP connection, reuse an existing opened connection, build several connections -- usually max 3 conn per DNS--, etc). Apache does nothing in this part of the job.
So why absolute url are bad? Not because of the job the browser should have to do handling it (which is in fact nothing, his job is transforming relative url to absolute ones); It's because if your web application use only relative url the admin of the web server will have far more possibilities on proxying your application. For example:
he will be able to server your web application on several different DNS domains
(and then make the browser think he's talking to several servers, parallelizing static files downloads)
he could as use use this multi-domain to set up the application for different costumers
he could build an HTTPS access for external network access and an HTTP (without the S) access on a local name for the local network
And if your application is building the absolute url these tasks will become really harder.
dont use absolute URL's . As i feel it will do a round trip in your case as you have used round trip for the action part. so better use releative URL's