caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
56.45k stars 3.96k forks source link

vue history mode with caddy2 rewrite #3291

Closed Virgil-N closed 4 years ago

Virgil-N commented 4 years ago

My static files handled by caddy and ajax request handled by tomcat. I use vue with history mode. My Caddyfile is here: `localhost:2019 { encode gzip

header / { Strict-Transport-Security "max-age=31536000;" X-XSS-Protection "1; mode=block" X-Content-Type-Options "nosniff" X-Frame-Options "DENY" }

header /static/js { Content-Type "application/javascript; charset=utf-8" }

header /static/css { Content-Type "text/css; charset=utf-8" }

header /api { Access-Control-Allow-Origin * Access-Control-Allow-Methods "GET, POST, DELETE, OPTIONS" Content-Type "application/javascript" }

handle * / {

route /api/* {
  uri strip_prefix api
  reverse_proxy http://xxx.xxx.xx.xxx:8097
}

} // something wrong here rewrite * /

root C:/mySoftware/caddy/site file_server

log { output file access.log format single_field common_log }
} `

Whitout rewrite is fine. When i add it, my chrome page is bank and console prints: Resource interpreted as Stylesheet but transferred with MIME type text/html. As u can see, I had add some headers, but it dose not work. So please help me solve this problem.

Virgil-N commented 4 years ago

https://caddy.community/ is blocked.

mholt commented 4 years ago

https://caddy.community/ is blocked.

What do you mean?

When i add it, my chrome page is bank and console prints: Resource interpreted as Stylesheet but transferred with MIME type text/html.

Usually this is because the file has a non-standard extension or the system does not have a proper MIME Types table installed.

(Going to close this issue as it appears to be more of a question about how to use Caddy, rather than a bug in Caddy itself, but feel free to continue the discussion, at least until you can access the forum.)

Virgil-N commented 4 years ago

https://caddy.community/ is blocked.

What do you mean?

I can't open it without a VPN. I will solve it.

mholt commented 4 years ago

Is your government blocking it? That'd be the first I've heard of it. Wonder if it's collateral damage from an overly aggressive blacklist.

Virgil-N commented 4 years ago

Yes, it is very discommodiousness.

mholt commented 4 years ago

I had to look up that word

Virgil-N commented 4 years ago

I mean inconvenient. 😅

mholt commented 4 years ago

Sorry about that. We'll try and look into possible solutions when we have a chance!

Until you can access the forums, feel free to continue discussion here as necessary until you get an answer to your question.

Virgil-N commented 4 years ago

Sorry about that. We'll try and look into possible solutions when we have a chance!

Until you can access the forums, feel free to continue discussion here as necessary until you get an answer to your question.

OK.