0

I'm currently using this solution to host my angular application on AWS S3 using Html5Mode: S3 Static Website Hosting Route All Paths to Index.html

My problem is that I want to keep the querystring during the redirection:

http://domain.org/posts?order=2 currently redirect to http://domain.org/#!/posts

I want it to go to http://domain.org/#!/posts?order=2.

Is this even possible?

Community
  • 1
  • 1
jbuiss0n
  • 468
  • 2
  • 17

2 Answers2

0

Yes this is possible.

This probably happens because you don't forward the query strings from CloudFront to the S3 static website.

tepez
  • 476
  • 8
  • 16
0

The proper way to do this is to set the querystring first, then your hash fragment.

/?order=2#!/posts

Anything after # is not sent to the server. I know it seems the opposite of what you are trying to achieve, but this is how things work. QueryString parameters are sent to the server. Hash fragments are not and a QueryString in the hash fragment is still part of the hash fragment, so it is not transferred to the server.

Machavity
  • 29,816
  • 26
  • 86
  • 96
Chris Love
  • 3,570
  • 1
  • 18
  • 15