grep -rlw no-referrer /var/www/html/webtop |\nwhile read FILE\ndo\n sed -i 's/\\bno-referrer\\b/same-origin/g' \"$FILE\"\ndone\n location / {\n if ($http_referer ~ /webtop(?:/|\\?|$)) {\n return 301 $scheme://$host/webtop$request_uri;\n }\n location ~ ^/webtop(?:/|$) {\n # Usual configuration directives. If none, just leave this location block empty\n }\n }\n<IfModule mod_rewrite.c>\n RewriteCond %{REQUEST_URI} !^/webtop(?:/|$)\n RewriteCond %{HTTP_REFERER} /webtop(?:/|\\?|$)\n RewriteRule ^ /webtop%{REQUEST_URI} [END,R=301]\n</IfModule>\nThe above Nginx configuration says: If the request URI starts with /webtop do usual stuff or nothing special, to send response. If not, check its Referer. If the Referer starts with /webtop that means the request is for daedalOS and therefore redirect it to /webtop sub-directory. We only check the Referer if the URI does not start with /webtop, because those requests can be fulfilled normally without any rewriting or redirecting.
","upvoteCount":1,"url":"https://github.com/DustinBrett/daedalOS/discussions/449#discussioncomment-9850152"}}}-
|
The final output in out/ directory assumes that I host files in the root of my website under /. It contains many absolute URL links starting with / |
Beta Was this translation helpful? Give feedback.
-
|
I don't think this would be easy to do because lots of the logic is based around starting at the root path. Perhaps if you can, put daedalOS on a subdomain of your site, such as, |
Beta Was this translation helpful? Give feedback.
-
|
While investigating a better and more robust solution, I discovered that many Ajax requests are made without HTTP-Referer header :( Please see if you can fix this, such that all http and https requests, no matter how they are made, are made with HTTP-Referer header. I place my final out/* contents in my DocRoot/webtop. The following Nginx configuration will rewrite requests made to / to /webtop The drawback of this method is that when some of the Ajax requests are made without HTTP-Referer header for /System/... or /Users/... we redirect the browser to /webtop. But then I cannot have two installations of daedalOS in two different sub-directories: /webtop and /webtopnew This is why it is important to modify the code such that ALL requests are made with HTTP-Referer header. I realize that HTTP-Referer can be spoofed and not reliable... but right now, I don't have any better solution |
Beta Was this translation helpful? Give feedback.
-
|
Here's the full working solution. It's server-side but it works. Suppose you want to serve daedalOS as example.com/webtop After you run "yarn build" it will generate "out" directory.
The above Nginx configuration says: If the request URI starts with /webtop do usual stuff or nothing special, to send response. If not, check its Referer. If the Referer starts with /webtop that means the request is for daedalOS and therefore redirect it to /webtop sub-directory. We only check the Referer if the URI does not start with /webtop, because those requests can be fulfilled normally without any rewriting or redirecting. |
Beta Was this translation helpful? Give feedback.
Here's the full working solution. It's server-side but it works. Suppose you want to serve daedalOS as example.com/webtop
After you run "yarn build" it will generate "out" directory.