Hello,
I use Django/Nginx, and I’d like to serve static files “/assets/*” with both http and https.
My Cloudflare configurations:
- DNS
- Crypto
- SSL: Full(Strict)
- Always Use HTTS: Off
- Automatic HTTPS Rewrites: Off
- Page Rules
If I try to connect to “example.com”, I see the response by nginx.
However, it is automatically redirected to HTTPS if I access “www.example.com”.
I would like to access https only if I explicity set the protocol.
Thank you.
sandro
4
Would you have an asset link too? A / request returns a 403 however no HTTPS redirect, so it might be a local configuration.
I’d like to make this link to be connected to HTTP:
http://www.pincoin.co.kr/assets/images/shop/default/pincoin_230px.png
The followings are my nginx settings:
server {
listen 80;
server_name www.pincoin.co.kr pincoin.co.kr;
root /path/to/repo;
location /assets/ {
access_log off;
log_not_found off;
location ~ \.(jpeg|jpg|png|gif) {
expires 30d;
add_header Cache-Control "public";
}
location ~ \.(css|js) {
expires -1;
add_header Cache-Control "public";
}
}
}
server {
listen 443 ssl;
server_name www.pincoin.co.kr;
charset utf-8;
root /path/to/repo;
location = /favicon.ico {
access_log off;
log_not_found off;
expires 30d;
add_header Cache-Control "public";
}
location /assets/ {
access_log off;
log_not_found off;
location ~ \.(jpeg|jpg|png|gif) {
expires 30d;
add_header Cache-Control "public";
}
location ~ \.(css|js) {
expires -1;
add_header Cache-Control "public";
}
}
}
Thank you.
sandro
6
There is no redirect involved, the file gets served via HTTP and HTTPS.
I think it must be served via HTTP and HTTPS, but my firefox browser and adroid chrome it to redirect to HTTPS.
Could it be browser cache?
sandro
8
It could be, try clearing the cache and maybe a fresh browser instance.
Thank you for your feedback.
I see the correct files after deleting all caches from chrome.
ps. Let me remove my nginx settings.
Thank you again.
system
Closed
10
This topic was automatically closed after 31 days. New replies are no longer allowed.