How could I create a dynamic URL redirect? - url

I want mywebsite.com/STUFF to redirect anotherwebsite.com/STUFF
So basically, I want a certain part of the URL I type ("STUFF") to be inputted into the redirected URL. Is this possible?
P.S.: Using Apache

Related

Get values without using sessions

I am using a payment portal in which i need to define a request url in their admin panel. For eg, I need to log in their admin panel and then set my url in which the pay from xyz is. As of now my url is project/:id/contribution/id/payment_method/:type. Since my url is dynamic, i cant use this url in the admin panel but have to set some static url like domain/contirbute
The easy part of having dynamic url is i can fetch project or contribtion from params but if i have a staic url like /contribute I will have to depend upon session.
Is there a to get this done without using session?
The funny thing is that , I tired making req with my dynamic url but only after changing the url in the url bar with js but that did nt work too lol.
In the dynamic url page, i have a form which makes a post req to the url given by the payment portal. How does they know form which url is the req comming from?
one way we can solve this problem is by creating two routes. One will be used to render the page which is the static url and the next one will be dynamic url. So when user submits the btn, the user will use ajax to make req with the dynamic url and the origin in the header is still preserved.
I called those payment portal and they had a checkbox in their own admin panel which could allow to make req from dynamic url

How to add all urls starting with some url to zendesk api client

I'm making oauth with Zendesk and I need to add redirect urls to api client on Zendesk. What I want to do is to accept all urls that starts with example.com/something/. For example:
Is it possible to do and if yes how?
Nikola,
It is not possible to have dynamic redirect URLs. Security is the main reason for this. Is it possible for you to collect whatever data is being used in the path as a parameter?
It is not possible to have dynamic redirect URLs.
In our case, we've decided to save that url in cookie. Then we redirect our user from oauth to the same page ("Thank you for allowing access to our app"), and then redirect it to specific url saved in cookie.

Redirect multiple domains to same azure website with custom parameters

I have a scenario where I have a web site that will be used by multiple customers.
But I do not want to publish the web site to each customer domain's. Instead I will publish the web site to an azure web site for example mywebsite.azurewebsites.net and I want all the customers domains to redirect to this mywebsite.azurewebsites.net but I need to know which customer is this so I can display the correct content. for example I am thinking about appending or sending a hidden custom parameter in the query string or such.
What I need to know is
How can I redirect all the domains to mywebsite.azurewebsites.net
How can I pass a hidden parameters in the redirect for example any request from the customer domain e.g "www.cust1.com/Home/Index" will be redirected to "mywebsite.azurewebsites.net/Home/Index?username=testuser" and "www.cust1.com/Home/Index?querystring=ffff" to "mywebsite.azurewebsites.net?querystring=ffff&username=testuser"
I do not want to publish any web site content on the customer web site that means the customer domain root directory will be empty.
There are quite a few different ways you can do this.
The first thing you need to determine is: How are you going to handle the redirection to mywebsite.azurewebsites.net?
Are you going to place code directly on the customers website to
redirect?
Do you have the access to the customers DNS's allowing you to forward their site to mywebsite.azurewebsites.net?
Do you want to create a CNAME record and point it to your Azure Website?
Method #1
If you have access to the customers website then this becomes the easiest method.
As you described above, I would simply redirect the user back to your site with some type of custom url i.e mywebsite.azurewebsites.net/customer1 .
When the user hits this page you could then set a cookie in their browser so that you know where they came from and then redirect them to the home page at mywebsite.azurewebsites.net. This would happen almost instantly and the customer would never notice.
Method #2
If you are able to forward the domain or they can only redirect the user to the main website at mywebsite.azurewebsites.net, you can simple look for the referring url when the request comes in. Then as you do above, based on the referring URL you can then set your cookie and show the proper content.
Method #3
This is assuming you have access to the customers DNS records and are able to create a CNAME record for www.customerwebsite.com -> mywebsite.azurewesbites.net
In that case, when the user visits the site you would just pull down the HOST and then set your content based on that.
The specific code is here:
string url = HttpContext.Current.Request.Url.AbsoluteUri;
// http://localhost:1302/TESTERS/Default6.aspx
string path = HttpContext.Current.Request.Url.AbsolutePath;
// /TESTERS/Default6.aspx
string host = HttpContext.Current.Request.Url.Host;
// localhost
You can find more information here: How to get the URL of the current page in C#
Let me know if you have any questions or end up implementing any of these solutions.

How do you Mask URLs in HAProxy?

Is there any way to do URL masking in HAProxy? I'd like to have a URL directing to my load balancer, i.e. www.example.com, redirect to another URL I have for another application. However, I'd like the user's browser to still display the original URL, (www.example.com). How would I go about this?

Missing HTTP_REFERER after redirect

I am trying to track the url that refered my website. One way is using a custom affiliate url which will do a redirect (302) to my site. I want to track where the users are coming from. However, I realize that after redirection, the HTTP_REFERER fro the header defaults to '/' when I was expecting it to be the url where the user was redirected from. Does the HTTP_REFERER header gets deleted after redirection? If yes, is there a way to store this information.
I am using rails for my website and I am doing request.referer to get the HTTP_REFERER.
Referers are not guaranteed; they are completely optional and any number of things could be stripping them.

Resources