Posts

Showing posts with the label amazon-cloudfront

WebSocket handshake cookies cloudfront deployment

Image
Clash Royale CLAN TAG #URR8PPP WebSocket handshake cookies cloudfront deployment I have an angular 6 app & python(django 2.0.6) back-end. Angular 6 app is deployed using AWS S3 & CloudFront. Angular 6 app use websocket functionality. Everything works well locally, but when deployed Angular 6 app fails to pass a cookies with websocket handshake request. (Authorization is by cookies only for websoket connection. There are reasons for that, not relevant.) Websocket server located at subdomain: `api.site.com`` i tried multiple ways to set cookies in angular 6 app, such as: let domain = 'api.site.com' document.cookie = `Token=${token}; domain=${domain}; path=/`; document.cookie = `Token=${token}; path=/`; document.cookie = `Token=${token}; document.cookie = `Token=${token}, domain=${domain}, path=/`; using ngx-cookie-service : ngx-cookie-service this.cookieService.set('Token', token, undefined, '/', 'api.site.com'); this.cookieService.set('Token...

wordpress wp-content/uploads folder 301 redirect to S3 bucket by cloudfrond CDN by .htaccess issues

Image
Clash Royale CLAN TAG #URR8PPP wordpress wp-content/uploads folder 301 redirect to S3 bucket by cloudfrond CDN by .htaccess issues See below, the .htacess file from wordpress. If I remove the part starting from #begin Wordpress. All the image file url will be change to d28rt1vkpsdxas.cloudfront.net/someimage.png successfully. However, all the internal link will be unable to access(only the home page can access). The error is Not Found The requested URL /shop/ was not found on this server. But if I keep the part start from #begin Wordpress. The cdn redirect will not work any more. All photos are missing. Thanks in advanced. Options +FollowSymlinks RewriteEngine on Rewriterule ^wp-content/uploads/(.*)$ http://exampled28t1vkps.cloudfront.net/$1 [r=301,nc] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END Wo...