Django urls with https behind nginx proxyAre HTTPS URLs encrypted?Does Django scale?Node.js + Nginx - What now?what's wrong with this configuration for nginx as reverse proxy for node.js?How to point many paths to proxy server in nginxExpress - req.ip returns 127.0.0.1Ngnix Jsession changed redirection issueWordpress constant redirect with nginx upstreamDeploy an https docker registry behind nginx on AWSKeycloak Redirect url with nginx is going to http rather than https

How can I make parentheses stick to formula?

Pre-1993 comic in which Wolverine's claws were turned to rubber?

Why are thrust reversers not used to slow down to taxi speeds?

How does weapons training transfer to empty hand?

Why is there a cap on 401k contributions?

Integral with DiracDelta. Can Mathematica be made to solve this?

How do I minimise waste on a flight?

How can I test a shell script in a "safe environment" to avoid harm to my computer?

Thawing Glaciers return to hand interaction

What's the "magic similar to the Knock spell" referenced in the Dungeon of the Mad Mage adventure?

Has everyone forgotten about wildfire?

What does the "DS" in "DS-..." US visa application forms stand for?

What are these round pads on the bottom of a PCB?

How to avoid making self and former employee look bad when reporting on fixing former employee's work?

Is it a Munchausen Number?

How likely are Coriolis-effect-based quirks to develop in starship crew members?

Gain of Non-Inverting Amplifier Does Not vary with Resistor Values

Program for finding longest run of zeros from a list of 100 random integers which are either 0 or 1

Ugin's Conjurant vs. un-preventable damage

Why does the electron wavefunction not collapse within atoms at room temperature in gas, liquids or solids due to decoherence?

Publishing an article in a journal without a related degree

Probability of taking balls without replacement from a bag question

How is Arya still alive?

Narcissistic cube asks who are we?



Django urls with https behind nginx proxy


Are HTTPS URLs encrypted?Does Django scale?Node.js + Nginx - What now?what's wrong with this configuration for nginx as reverse proxy for node.js?How to point many paths to proxy server in nginxExpress - req.ip returns 127.0.0.1Ngnix Jsession changed redirection issueWordpress constant redirect with nginx upstreamDeploy an https docker registry behind nginx on AWSKeycloak Redirect url with nginx is going to http rather than https






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I have django rest framework behind nginx proxy and some frontend on vue js.
The problem is that I have urls with "http" but I need it to be "https":



"images": [

"id": 2,
"image": "http://localhost:8000/media/documents/2019/02/26/d59b9c8d-bb36-4461-97ad-7455f19637b8/FVbJkfww_Sk.jpg"
,

"id": 1,
"image": "http://localhost:8000/media/documents/2019/02/26/902e5729-f7fd-480b-bf39-bca65a83038e/%D0%B4%D0%B6%D0%B5%D0%BA%D0%B8-%D1%87%D0%B0%D0%BD-%D0%BC%D0%B5%D0%BC-%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD.jpg"

]


nginx is configured like that:



server {
listen 8443 ssl;
server_name backend.mysite.net;
client_max_body_size 3200m;
proxy_connect_timeout 3000;
proxy_send_timeout 3000;
proxy_read_timeout 3000;
send_timeout 3000;

location /
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8000;



My django config os below:



SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_SSL_REDIRECT = True
USE_X_FORWARDED_HOST = True









share|improve this question
























  • how are those urls generated? Do you have django.contrib.sites in your INSTALLED_APPS in settings.py?

    – spiritsree
    Mar 23 at 9:18












  • In installed apps I have the following: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders', 'mysite', 'rest_framework', 'social_django', ]

    – lomach
    Mar 23 at 9:52











  • Ok. How are you generating those urls?

    – spiritsree
    Mar 23 at 9:58











  • With 'rest_framework' I guess.

    – lomach
    Mar 23 at 11:54

















1















I have django rest framework behind nginx proxy and some frontend on vue js.
The problem is that I have urls with "http" but I need it to be "https":



"images": [

"id": 2,
"image": "http://localhost:8000/media/documents/2019/02/26/d59b9c8d-bb36-4461-97ad-7455f19637b8/FVbJkfww_Sk.jpg"
,

"id": 1,
"image": "http://localhost:8000/media/documents/2019/02/26/902e5729-f7fd-480b-bf39-bca65a83038e/%D0%B4%D0%B6%D0%B5%D0%BA%D0%B8-%D1%87%D0%B0%D0%BD-%D0%BC%D0%B5%D0%BC-%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD.jpg"

]


nginx is configured like that:



server {
listen 8443 ssl;
server_name backend.mysite.net;
client_max_body_size 3200m;
proxy_connect_timeout 3000;
proxy_send_timeout 3000;
proxy_read_timeout 3000;
send_timeout 3000;

location /
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8000;



My django config os below:



SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_SSL_REDIRECT = True
USE_X_FORWARDED_HOST = True









share|improve this question
























  • how are those urls generated? Do you have django.contrib.sites in your INSTALLED_APPS in settings.py?

    – spiritsree
    Mar 23 at 9:18












  • In installed apps I have the following: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders', 'mysite', 'rest_framework', 'social_django', ]

    – lomach
    Mar 23 at 9:52











  • Ok. How are you generating those urls?

    – spiritsree
    Mar 23 at 9:58











  • With 'rest_framework' I guess.

    – lomach
    Mar 23 at 11:54













1












1








1








I have django rest framework behind nginx proxy and some frontend on vue js.
The problem is that I have urls with "http" but I need it to be "https":



"images": [

"id": 2,
"image": "http://localhost:8000/media/documents/2019/02/26/d59b9c8d-bb36-4461-97ad-7455f19637b8/FVbJkfww_Sk.jpg"
,

"id": 1,
"image": "http://localhost:8000/media/documents/2019/02/26/902e5729-f7fd-480b-bf39-bca65a83038e/%D0%B4%D0%B6%D0%B5%D0%BA%D0%B8-%D1%87%D0%B0%D0%BD-%D0%BC%D0%B5%D0%BC-%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD.jpg"

]


nginx is configured like that:



server {
listen 8443 ssl;
server_name backend.mysite.net;
client_max_body_size 3200m;
proxy_connect_timeout 3000;
proxy_send_timeout 3000;
proxy_read_timeout 3000;
send_timeout 3000;

location /
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8000;



My django config os below:



SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_SSL_REDIRECT = True
USE_X_FORWARDED_HOST = True









share|improve this question
















I have django rest framework behind nginx proxy and some frontend on vue js.
The problem is that I have urls with "http" but I need it to be "https":



"images": [

"id": 2,
"image": "http://localhost:8000/media/documents/2019/02/26/d59b9c8d-bb36-4461-97ad-7455f19637b8/FVbJkfww_Sk.jpg"
,

"id": 1,
"image": "http://localhost:8000/media/documents/2019/02/26/902e5729-f7fd-480b-bf39-bca65a83038e/%D0%B4%D0%B6%D0%B5%D0%BA%D0%B8-%D1%87%D0%B0%D0%BD-%D0%BC%D0%B5%D0%BC-%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD.jpg"

]


nginx is configured like that:



server {
listen 8443 ssl;
server_name backend.mysite.net;
client_max_body_size 3200m;
proxy_connect_timeout 3000;
proxy_send_timeout 3000;
proxy_read_timeout 3000;
send_timeout 3000;

location /
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8000;



My django config os below:



SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_SSL_REDIRECT = True
USE_X_FORWARDED_HOST = True






django ssl nginx django-rest-framework






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 12:17







lomach

















asked Mar 23 at 9:06









lomachlomach

63




63












  • how are those urls generated? Do you have django.contrib.sites in your INSTALLED_APPS in settings.py?

    – spiritsree
    Mar 23 at 9:18












  • In installed apps I have the following: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders', 'mysite', 'rest_framework', 'social_django', ]

    – lomach
    Mar 23 at 9:52











  • Ok. How are you generating those urls?

    – spiritsree
    Mar 23 at 9:58











  • With 'rest_framework' I guess.

    – lomach
    Mar 23 at 11:54

















  • how are those urls generated? Do you have django.contrib.sites in your INSTALLED_APPS in settings.py?

    – spiritsree
    Mar 23 at 9:18












  • In installed apps I have the following: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders', 'mysite', 'rest_framework', 'social_django', ]

    – lomach
    Mar 23 at 9:52











  • Ok. How are you generating those urls?

    – spiritsree
    Mar 23 at 9:58











  • With 'rest_framework' I guess.

    – lomach
    Mar 23 at 11:54
















how are those urls generated? Do you have django.contrib.sites in your INSTALLED_APPS in settings.py?

– spiritsree
Mar 23 at 9:18






how are those urls generated? Do you have django.contrib.sites in your INSTALLED_APPS in settings.py?

– spiritsree
Mar 23 at 9:18














In installed apps I have the following: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders', 'mysite', 'rest_framework', 'social_django', ]

– lomach
Mar 23 at 9:52





In installed apps I have the following: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'corsheaders', 'mysite', 'rest_framework', 'social_django', ]

– lomach
Mar 23 at 9:52













Ok. How are you generating those urls?

– spiritsree
Mar 23 at 9:58





Ok. How are you generating those urls?

– spiritsree
Mar 23 at 9:58













With 'rest_framework' I guess.

– lomach
Mar 23 at 11:54





With 'rest_framework' I guess.

– lomach
Mar 23 at 11:54












1 Answer
1






active

oldest

votes


















0














You are missing proxy_set_header X-Forwarded-Proto https in your location



Update to



location / 
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https
proxy_pass http://localhost:8000;



If that doesn't work try



location / 
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https
proxy_redirect off;
proxy_pass http://localhost:8000;






share|improve this answer























  • No, that doesn't help.

    – lomach
    Mar 23 at 14:16











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55312200%2fdjango-urls-with-https-behind-nginx-proxy%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You are missing proxy_set_header X-Forwarded-Proto https in your location



Update to



location / 
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https
proxy_pass http://localhost:8000;



If that doesn't work try



location / 
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https
proxy_redirect off;
proxy_pass http://localhost:8000;






share|improve this answer























  • No, that doesn't help.

    – lomach
    Mar 23 at 14:16















0














You are missing proxy_set_header X-Forwarded-Proto https in your location



Update to



location / 
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https
proxy_pass http://localhost:8000;



If that doesn't work try



location / 
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https
proxy_redirect off;
proxy_pass http://localhost:8000;






share|improve this answer























  • No, that doesn't help.

    – lomach
    Mar 23 at 14:16













0












0








0







You are missing proxy_set_header X-Forwarded-Proto https in your location



Update to



location / 
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https
proxy_pass http://localhost:8000;



If that doesn't work try



location / 
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https
proxy_redirect off;
proxy_pass http://localhost:8000;






share|improve this answer













You are missing proxy_set_header X-Forwarded-Proto https in your location



Update to



location / 
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https
proxy_pass http://localhost:8000;



If that doesn't work try



location / 
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https
proxy_redirect off;
proxy_pass http://localhost:8000;







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 23 at 10:04









spiritsreespiritsree

1,8801523




1,8801523












  • No, that doesn't help.

    – lomach
    Mar 23 at 14:16

















  • No, that doesn't help.

    – lomach
    Mar 23 at 14:16
















No, that doesn't help.

– lomach
Mar 23 at 14:16





No, that doesn't help.

– lomach
Mar 23 at 14:16



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55312200%2fdjango-urls-with-https-behind-nginx-proxy%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현