Nginx subdirectory set up not taken into account when creating "Sign in with ..." link #962
Replies: 3 comments 2 replies
-
pls see the relevant docs and this one if you still have an issue pls provide your nginx config and remark42 config |
Beta Was this translation helpful? Give feedback.
-
because this is not a bug report I'll move it to Discussion |
Beta Was this translation helpful? Give feedback.
-
I faced this error too. My Remark42 config: <div id="remark42"></div>
<script>
var remark_config = {host: "https://smarthdd.com/remark", site_id: 'smarthdd.com', url: 'https://smarthdd.com/aam.htm'};
!function(e,n){for(var o=0;o<e.length;o++){var r=n.createElement("script"),c=".js",d=n.head||n.body;"noModule"in r?(r.type="module",c=".mjs"):r.async=!0,r.defer=!0,r.src=remark_config.host+"/web/"+e[o]+c,d.appendChild(r)}}(remark_config.components||["embed"],document);
</script> My Nginx config: user nginx;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 8192;
error_log /var/log/nginx/error.log warn;
events {worker_connections 4096;}
http {
server_tokens off;
sendfile on;
tcp_nopush on;
include /etc/nginx/mime.types;
charset UTF-8;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_session_tickets on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
ssl_stapling on;
ssl_stapling_verify on;
ssl_buffer_size 4k;
ssl_early_data on;
resolver 1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4;
resolver_timeout 2s;
access_log off;
log_not_found off;
gzip_vary on;
gzip_proxied any;
server {
listen 80;
listen [::]:80;
server_name smarthdd.com www.smarthdd.com;
return 301 https://smarthdd.com$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
include my-conf/smarthdd-ssl-certificates.conf;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
server_name www.smarthdd.com;
return 301 https://smarthdd.com$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
include my-conf/smarthdd-ssl-certificates.conf;
root /var/www/smarthdd.com/html;
server_name smarthdd.com;
access_log /var/log/nginx/smarthdd.com.log;
error_page 404 /404.htm;
location =/404.htm {etag off;}
gzip_static on;
rewrite (.*).gz$ $1 permanent;
index index.htm;
if ($request_uri ~ ^(.*/)index.htm$) {return 301 $1;}
rewrite ^/en/(.*) /$1 permanent;
location ~ \.(?:png|jpg|ico|cur)$ {add_header Cache-Control "public, max-age=31536000, immutable";}
location ~ \.exe$ {add_header Cache-Control no-cache;}
location ~ \.htm$ {
add_header Cache-Control no-cache;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
add_header Content-Security-Policy "script-src 'strict-dynamic' 'nonce-mihPp2tZLqfwlptpYr4dZw==' 'unsafe-inline' https:; object-src 'none'; base-uri 'none'; report-uri https://hcode.report-uri.com/r/d/csp/enforce";
}
location =/version.txt {add_header Cache-Control no-cache;}
location =/robots.txt {add_header Cache-Control "public, max-age=604800"; add_header X-Robots-Tag noindex;}
location =/sitemap.xml {add_header Cache-Control no-cache; add_header X-Robots-Tag noindex;}
location ^~ /remark/ {
gzip_static off;
gzip on;
gzip_types text/plain application/json text/css application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
proxy_max_temp_file_size 0;
rewrite /remark/(.*) /$1 break;
proxy_pass http://127.0.0.1:8080/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
} After clicking on the login button through Google Account transition takes place at:
with a 404 error. |
Beta Was this translation helpful? Give feedback.
-
If you setup remark42 underneath a subdirectory like /remark42 instead of a subdomain the login with oauth link shows the base url only and does not show /remark42/. Clicking on the login with github link would obviously just 404 you. Using a subdomain works but with a subdirectory it doesn't unless you manually add in a nginx location to forward the oauth link with /remark42 preprended.
I only tried this with the github oauth.
Beta Was this translation helpful? Give feedback.
All reactions