Reverse Proxy rewrites domain in external links in posts

Hello!

We have forum installed in subfolder: https://i.materialise.com/forum/

We have problem with external links in posts. When user clicks on external link, he gets redirect to URL with our main site domain with path and query string from original URL, but not to original URL.

For example:

User gets https://i.materialise.com/watch?v=%3cvideo_id, instead of original link to Youtube: https://youtube.com/watch?v=%3cvideo_id)

And this behavior reproduces for any external links. Open in new tab via context menu and mouse middle button click works well.

I did some investigation and found that on click on link, we call, for example: https://i.materialise.com/forum/clicks/track?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dk-r-zmItM0Q and ServiceWorker redirects us to URL https://i.materialise.com/watch?v=k-r-zmItM0Q with status code 302. I spent a lot of time on this forum and didn`t find any idea what can be wrong with settings.

We have many complaints from community members and I will be very appreciate for any assistance or advice how to solve this problem.

Thanks.

Are you running latest? Can you link us to a particular post exhibiting the problem? @Falco are you aware of any subfolder issues with the link tracker?

Hey @tpavliuk,

I just tried to repro this using latest Chrome and Firefox, in a production site running latest in a subfolder setup. No dice so far.

This sounds like something is off in your setup.

Did you follow this guide to setup the subfolder setup?

4 Likes

@sam, we are running latest version 2.0.0.beta4 +78. We updating our instance regularly. We are live with mentioned problem for some time with different versions.
Live post with problem is here: Tritangle by OSKAR - My i.materialise Order Arrived - i.materialise

@Falco, yes, I setted up my instance according to mentioned guide.

And what guide did you follow for the external reverse proxy you are using? I see a bunch of extra cookies, etc…

We using IIS for external reverse proxy.

Cool, I just tested in your live site, after disabling ServiceWorkers, and the problem persist.

I think it’s an error on the reverse proxy configuration, because I can repro the error with a simple curl:

➜  ~ curl -v https://i.materialise.com/forum/clicks/track\?url\=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DRaiLd3QBmC0\&post_id\=589\&topic_id\=388                 
*   Trying 54.208.178.103...
* Connected to i.materialise.com (54.208.178.103) port 443 (#0)
> GET /forum/clicks/track?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DRaiLd3QBmC0&post_id=589&topic_id=388 HTTP/1.1
> Host: i.materialise.com
> User-Agent: curl/7.55.1
> Accept: */*
> 
< HTTP/1.1 302 Found
< Cache-Control: no-store, must-revalidate, no-cache, private
< Content-Type: text/html; charset=utf-8
< Location: https://i.materialise.com/watch?v=RaiLd3QBmC0
< Set-Cookie: GaClientId=84c67115-16e3-4963-887a-b4455b6fe63d; expires=Fri, 19-Mar-2021 13:56:40 GMT; path=/
< Set-Cookie: GaClientId=84c67115-16e3-4963-887a-b4455b6fe63d; expires=Fri, 19-Mar-2021 13:56:40 GMT; path=/
< Set-Cookie: lang=EN; expires=Mon, 17-Sep-2018 13:56:40 GMT; path=/
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Discourse-Route: clicks/track
< X-Request-Id: 1055bd86-75bd-4020-8840-0b4f6a18f1b3
< X-Runtime: 0.006256
< Referrer-Policy: no-referrer-when-downgrade
< P3P: policyref="/w3c/p3p.xml", CP="CAO CURa ADMa DEVa TAIa OUR BUS UNI PUR COM NAV INT CNT STA"
< Date: Mon, 19 Mar 2018 13:56:39 GMT
< Content-Length: 109
< 
* Connection #0 to host i.materialise.com left intact
<html><body>You are being <a href="https://www.youtube.com/watch?v=RaiLd3QBmC0">redirected</a>.</body></html>

Look at the Location header in the response.

4 Likes

Thanks, I’ll investigate this on next few days. And I’ll reply with results. Hope to find out solution.

That sounds a lot like this issue although I don’t think it’s exactly the same. Apparently IIS is decoding the URLencoded part first, and then replacing everything in front of the last ?

Can you post the relevant part of your IIS configuration here?

2 Likes

Guys, thanks a lot to everyone for help. Your posts directed me to different investigations and I found problem and fixed it.
Problem was in Application Request Routing configuration in our IIS.

3 Likes

This topic was automatically closed after 6 hours. New replies are no longer allowed.