question

JohnDoe-6348 avatar image
0 Votes"
JohnDoe-6348 asked GitaraniSharmaMSFT-4262 commented

Application Gateway V1 External Site Redirection Adds Trailing Slash

Recently setup an Application Gateway to perform some URL redirects but I've run into an issue. I have a routing rule to redirect traffic to an external site, however, when the AppGw redirects to the external site it adds a trailing slash "/" to the end of the URL.

Example:
I want to redirect www.blahblah.com/foobar >to> www.blahblah.com/foo/bar

The AppGw instead redirects to www.blahblah.com/foo/bar/

Is there a way around this? Or is this expected behavior when the AppGw redirects to an external site/URL?

Thanks.

azure-application-gateway
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

GitaraniSharmaMSFT-4262 avatar image
0 Votes"
GitaraniSharmaMSFT-4262 answered GitaraniSharmaMSFT-4262 commented

Hello @JohnDoe-6348 ,

Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.

I understand that you setup an Application gateway to perform URL redirects but one routing rule which redirects to an external site is adding a trailing slash "/" at the end of the URL and is causing issues.

This is expected when the "Include Path" option is enabled in your routing rule as below:

198197-image.png

To fix this issue, please disable the "Include Path" option in your routing rule.

198209-image.png

Kindly let us know if the above helps or you need further assistance on this issue.


Please "Accept the answer" if the information helped you. This will help us and others in the community as well.



image.png (31.7 KiB)
image.png (31.4 KiB)
· 9
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi thanks for your response @GitaraniSharmaMSFT-4262
I changed the "Include Path" setting to "Off" and tested but it still seems to add a forward slash to the end of the Target URL when performing the redirection.

The first screenshot is the rule, the second screenshot is the URL in the browser. You can see it continues to add the forward slash.

198140-image.png


198244-image.png


0 Votes 0 ·
image.png (24.0 KiB)
image.png (6.9 KiB)

Update: After clearing cache, having the "Include Path" option set to off does remove the added trailing forward slash. This now introduces another problem since we are using the Path-based routing to route to different external sites based off of the URL Path. If it adds the additional forward slash it breaks some of the URL's. Is there anyway to have the option "include path" set to ON and have it NOT add the trailing forward slash? Thanks for your help.

0 Votes 0 ·

Hello @JohnDoe-6348 ,

Thank you for the update.

AFAIK, there is no way to have the option "include path" set to ON and have it NOT add the trailing forward slash but let me discuss this with the Product group team and get back to you with an update.

Also, I didn't understand the new problem that you've mentioned as "This now introduces another problem since we are using the Path-based routing to route to different external sites based off of the URL Path. If it adds the additional forward slash it breaks some of the URL's." Could you please let me know what is the new issue that you are encountering?

Regards,
Gita

0 Votes 0 ·

Hello @JohnDoe-6348 ,

Could you please provide an update on this post and let me know what is the new issue that you are encountering?

Regards,
Gita

0 Votes 0 ·

Hello @JohnDoe-6348 , do you have any updates on this issue?

0 Votes 0 ·
JohnDoe-6348 avatar image JohnDoe-6348 GitaraniSharmaMSFT-4262 ·

Hi thank you for following up. We ended up having to use a different solution since we could not get this working.

The new problem that I started to face was we had multiple URL paths that we needed to forward to a different external site. With the "include path" option set to off, it was not properly forwarding to the correct external site based on the path entered.

0 Votes 0 ·
Show more comments