akamai redirects to origin server 302 redirects - akamai

I have a jsp (test1.jsp) which has a code response.sendRedirect("xxx/jsp/test2.jsp");
when i access it with akamai url, it is redirecting to origin server.
http://akamai.domain/xxx/jsp/test1.jsp
redirects to
http://origin.domain/xxx/jsp/test2.jsp
can some one advise what has to be done to fix it?

Prepend the Akamai CDN URL to the path:
String akamai_url = "http://akamai.domain/xxx/jsp/test2.jsp";
response.sendRedirect(akamai_url);

Related

AWS Amplify Redirects Gatsby 404 to Root URL

I have deployed a multi-page gatsby site both to AWS Amplify and Netlify.
When I go to a page that doesn't exist on my site that was deployed with Netlify, I get the 404 page I have created. But when I go to the same non-existent route on the site with Amplify, it redirects me to the root path.
I have checked the network tab, and I get a 404 status code without any HTTP redirects. So I assume the redirect happens in the JavaScript code?
Does this happen to anyone else?
Here is the default Rewrites and Redirects for my site on Amplify:
The solution was to change the target address from /index.html to /404.html like this:
I exprienced this same issue, but with all pages reloading to the homepage if they weren't ended with a '/'. Removing all the rewrite rules seemed to fix this for me. I wasn't using any of them and they were set as defaults. Such as 'www' rerouting to '/'.

302 Redirect in AWS Cloudfront

I have a webstack that is currently serving both dynamic and static content. I want start serving the static content from AWS CloudFront without having to change all of the urls.
So I set up CloudFront to serve the static content from AWS S3 and the dynamic content from a custom url (current webstack). This worked however CloudFront was making the request to our webstack via a rewrite rule.
Is it possible for CloudFront to return a 302 redirect so that the request to my webstack would come from the users browser?
Unfortunately this is critical for our application to work properly.
I don't think it's possible, because CloudFront should follow 302 redirects and cache the result, rather than return the 302 redirect to the client.

website be opened with redirection from stranger domaine

my problem is:
I own a website developed with django framework and uploaded in heroku.
my domain is "OnlyMyDomain.com", but "StrangeDomaine.com" calls my website with a redirect. in other words when you go to StrangeDomaine.com, my website is opened even if the address change to OnlyMyDomain.com.
I tried in my settings.py:
DEBUG = False
ALLOWED_HOSTS = ['OnlyMyDomain.com']
Please can someone explain to me where the problem is coming from? and how can I avoid it?
There is no problem. It seems that you define a permanent redirection (301) from StrangeDomain.com to OnlyMyDomain.com. Then request url will be updated, then StrangeDomain.com becomes OnlyMyDomain.com. If you want to avoid that, just remove this redirection.
The HTTP response status code 301 Moved Permanently is used for
permanent URL redirection, meaning current links or records using the
URL that the response is received for should be updated. The new URL
should be provided in the Location field included with the response.
Wiki : HTTP 301

Amazon AWS 307 response and permanent redirect to HTTPS

I have a domain from GoDaddy, with AWS Route53 for managing DNS records. Route53 sends request to a load-balancer.
For webserver I have a load-balancer that routes requests to a single (for now) EC2 instance and the nginx in EC2 instance get the request and sends a response to the client.
The problem is that when I use http:// to perform a request, AWS redirects requests to the https:// version of the domain with 307 Internal Redirect response. The response object has Non-Authoritative-Reason: HSTS header as well.
What's the problem and which component is redirected requests?
It's neither component.
This isn't anything from AWS... it's the browser. It's an internal redirect the browser is generating, related to HSTS... HTTP Strict Transport Security.
If you aren't doing it now, then presumably, in the past, you've generated a Strict-Transport-Security: header in responses from this domain, and the browser has remembered this fact, preventing you from accessing the site insecurely, as it is intended to do.
I know I'm lat eto the party but I wanted to post the actual full solution this this inspired from this post on the Wordpress forums.
Just removing the HSTS header from the server will not solve it because the browser cached the HSTS response and will continue triggering https:// for that website regardless. In Chrome/Chromium you can delete the website from about://net-internals/#hsts but that's hardly a solution for your visitors as you have no idea how many already cached it as HSTS.
On the server side, you need to set max-age=0 which will (as per the RFC) ask the browser to stop considering that host as HSTS.
In Apache, do the following:
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=0"
</IfModule>
and make sure you enabled the headers module (you can use a2enmod headers on Ubuntu/Debian/Mint).

AWS Cloudfront redirecting form post to origin

Hi I have a dynamic application that has a search form. I'm trying to use CloudFront with a load balancer. When you do a search the application creates some URL parameters and reloads the page. For some reason cloudfront is doing a 302 redirect back to the origin. Does anybody know how to fix this?
I have the following configuration.
It's clear that you're going to want to turn on Forward Query Strings. Without it, cloudfront will treat the following urls as the same:
http://www.example.com
http://www.example.com?q=search_term
http://www.example.com?q=search_term&option=true
It's however not clear to me that this would result in 302 to the original url (btw. origin means something very specific when dealing with cloudfront/other cdns - it's often short for origin server which is the source behind the cdn)
The 302 redirect is much more likely to your Viewer Protocol Policy, which you have set http requests to redirect to http. You should double check that your application isn't reloading the http version of the page.