rewrite /secure

This commit is contained in:
Karol Wypchlo 2020-12-16 14:42:39 +01:00
parent 3d897cb3ab
commit c806129ba7
4 changed files with 33 additions and 13 deletions

View File

@ -57,6 +57,7 @@ server {
rewrite ^/portals /skynet/portals permanent;
rewrite ^/stats /skynet/stats permanent;
rewrite ^/skynet/blacklist /skynet/blocklist permanent;
rewrite ^/secure/(.*) https://secure.$domain.$tld/$1;
location / {
# This is only safe workaround to reroute based on some conditions
@ -347,12 +348,6 @@ server {
proxy_pass http://127.0.0.1/$uri?attachment=true&$args;
}
location /secure {
rewrite /secure/(.*) /$1 break;
proxy_redirect http://127.0.0.1/ https://$host/;
proxy_pass http://oathkeeper:4455;
}
# include custom locations, specific to the server
include /etc/nginx/conf.d/server-override/*;
}

View File

@ -20,6 +20,7 @@
"gatsby-source-filesystem": "2.4.0",
"gatsby-transformer-sharp": "2.5.21",
"http-status-codes": "2.1.4",
"js-cookie": "^2.2.1",
"jsonp": "0.2.1",
"node-sass": "4.14.1",
"path-browserify": "1.0.1",

View File

@ -1,9 +1,12 @@
import React from "react";
import Cookies from "js-cookie";
import logo from "../../images/logo.svg";
import "./HomeTop.scss";
import { Skynet, Deco1, Deco2 } from "../../svg";
export default function HomeTop() {
const authenticated = Boolean(Cookies.get("skynet-jwt"));
return (
<div className="home-top">
<img src={logo} alt="Skynet logo" className="logo" />
@ -16,13 +19,24 @@ export default function HomeTop() {
</p>
<p className="auth-links">
<a href="/secure/auth/registration" className="link">
Sign up now!
</a>{" "}
Already have an account?{" "}
<a href="/secure/auth/login" className="link">
Log in!
</a>
{authenticated ? (
<>
Welcome back! Go to your{" "}
<a href="/secure/" className="link">
dashboard
</a>
</>
) : (
<>
<a href="/secure/auth/registration" className="link">
Sign up now!
</a>{" "}
Already have an account?{" "}
<a href="/secure/auth/login" className="link">
Log in!
</a>
</>
)}
</p>
<Deco1 className="deco-1" />

View File

@ -8647,6 +8647,11 @@ js-base64@^2.1.8:
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4"
integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==
js-cookie@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8"
integrity sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==
"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
@ -8795,6 +8800,11 @@ junk@^3.1.0:
resolved "https://registry.yarnpkg.com/junk/-/junk-3.1.0.tgz#31499098d902b7e98c5d9b9c80f43457a88abfa1"
integrity sha512-pBxcB3LFc8QVgdggvZWyeys+hnrNWg4OcZIU/1X59k5jQdLBlCsYGRQaz234SqoRLTCgMH00fY0xRJH+F9METQ==
jwt-decode@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59"
integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==
keyv@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.0.0.tgz#44923ba39e68b12a7cec7df6c3268c031f2ef373"