Why I got content-type text/html instead of application/json in rest api java after deployed on server?

huangapple go评论59阅读模式
英文:

Why I got content-type text/html instead of application/json in rest api java after deployed on server?

问题

以下是翻译好的内容:

这是我的本地项目的结果。

  • Vary:Origin Vary:Access-Control-Request-Method Vary:
    Access-Control-Request-Headers Content-Type:application/json
    Transfer-Encoding:chunked Date:2020年10月8日星期四15:51:02 GMT
    Keep-Alive:超时=60 连接:保持连接

这是远程服务器的结果。

  • 我们已完全上传并且正常 < HTTP/1.1 404 < Content-Type:text/html;charset=utf-8 < Content-Language:en < Content-Length:776 <
    Date:2020年10月8日星期四15:46:43 GMT
英文:

> This is the result of my local project.
> * Vary: Origin Vary: Access-Control-Request-Method Vary:
> Access-Control-Request-Headers Content-Type: application/json
> Transfer-Encoding: chunked Date: Thu, 08 Oct 2020 15:51:02 GMT
> Keep-Alive: timeout=60`` Connection: keep-alive


>This is the result of remote server.
> * We are completely uploaded and fine < HTTP/1.1 404 < Content-Type: text/html;charset=utf-8 < Content-Language: en < Content-Length: 776 <
> Date: Thu, 08 Oct 2020 15:46:43 GMT

答案1

得分: 1

从截图中可以看出,有更多的差异。最重要的区别是HTTP状态码。我无法从您的本地项目中看到它,但从tomcat服务器中可以看到状态码404:未找到。

所以要么您没有正确部署应用程序,要么在URL中出现了拼写错误,要么是应用程序内部决定返回404。

根据迄今为止您提供的信息很难确定问题出在哪里。您是否有来自tomcat服务器的日志?

英文:

From the screenshot, there are more differences. The most important difference is the HTTP status code. I can't see it from your local project, but from the tomcat server you get a status 404: Not Found.

So you either didn't deploy your application correct, you made a typo in the URL, or something inside your application decided to return a 404.

Hard to say which is the problem based on your input so far. Do you have logs from the tomcat server?

huangapple
  • 本文由 发表于 2020年10月9日 00:23:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/64266714.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定