mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 16:51:25 +08:00
DEV: Fix subfolder setup in dev env (#21983)
1. ember proxy stuff still isn't in a great shape, live-reload doesn't work yet, uploads made w/o subfolder won't work, custom fonts don't work, service worker doesn't work. But otherwise it's fine :P 2. I don't know why `HTTP_IF_MODIFIED_SINCE` can be an empty string. Don't have time to investigate, and fast_blank makes this fix an easy solution ;)
This commit is contained in:
@ -343,9 +343,9 @@ async function handleRequest(proxy, baseURL, req, res) {
|
|||||||
const csp = response.headers.get("content-security-policy");
|
const csp = response.headers.get("content-security-policy");
|
||||||
if (csp) {
|
if (csp) {
|
||||||
const emberCliAdditions = [
|
const emberCliAdditions = [
|
||||||
`http://${originalHost}/assets/`,
|
`http://${originalHost}${baseURL}assets/`,
|
||||||
`http://${originalHost}/ember-cli-live-reload.js`,
|
`http://${originalHost}${baseURL}ember-cli-live-reload.js`,
|
||||||
`http://${originalHost}/_lr/`,
|
`http://${originalHost}${baseURL}_lr/`,
|
||||||
].join(" ");
|
].join(" ");
|
||||||
|
|
||||||
const newCSP = csp
|
const newCSP = csp
|
||||||
@ -516,7 +516,7 @@ to serve API requests. For example:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.path.startsWith("/_lr/")) {
|
if (request.path.startsWith(`${baseURL}_lr/`)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class StylesheetsController < ApplicationController
|
|||||||
|
|
||||||
cache_time = request.env["HTTP_IF_MODIFIED_SINCE"]
|
cache_time = request.env["HTTP_IF_MODIFIED_SINCE"]
|
||||||
|
|
||||||
if cache_time
|
if cache_time.present?
|
||||||
begin
|
begin
|
||||||
cache_time = Time.rfc2822(cache_time)
|
cache_time = Time.rfc2822(cache_time)
|
||||||
rescue ArgumentError
|
rescue ArgumentError
|
||||||
@ -63,7 +63,7 @@ class StylesheetsController < ApplicationController
|
|||||||
|
|
||||||
handle_missing_cache(location, target, digest) if !stylesheet_time
|
handle_missing_cache(location, target, digest) if !stylesheet_time
|
||||||
|
|
||||||
if cache_time && stylesheet_time && stylesheet_time <= cache_time
|
if cache_time.present? && stylesheet_time && stylesheet_time <= cache_time
|
||||||
return render body: nil, status: 304
|
return render body: nil, status: 304
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user