开发者社区> 问答> 正文

发送请求'POST'Zuul和响应:请求方法'GET'不支持| 弹簧靴

我正在使用Spring Cloud,我配置了Eureka和Zuul。在Spring引导中部署Api Rest并通过Zuul使用rest POST服务时,我收到一条HTTP 405错误消息。

我正在检查日志,并出现以下消息:

Request method 'GET' not supported
2019-12-11 12: 19: 04.679 WARN 5724 --- [nio-8089-exec-6] .m.m.a.ExceptionHandlerExceptionResolver: Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported]

奇怪的是,当我直接使用该服务时,它可以正常工作,但是由于Zuul,看来我是通过GET发送的,但实际上我总是通过POST发送的。

Api Rest具有通过JWT配置的安全性,我不知道是否需要做任何额外的配置

非常感谢您,如果有人可以帮助我,我将不胜感激。

application.yml

spring:
  application:
    name: kentaurus-zuul-server

server:
  port: 8082
  servlet:
    contextPath: /api/v1

#Endpoints
#endpoints:
 # restart:
  #  enabled: true
  #shutdown:
  #  enabled: true
  #health:
   # sensitive: false

#Zuul routes active
zuul:
  routes:
    kentaurus-page-core:
      service-id: kentaurus-page-core
      path: /public/kentaurus-page/**
      sensitiveHeaders: Cookie,Set-Cookie
      url: http://localhost:8089
      # stripPrefix : true

management:
  endpoints:
    kentaurus-page-core:
      exposure:
        include: "*"
        exclude:

#Eureka Instance ID
eureka:
  client:
    registerWithEureka: true
    fetchRegistry: true
    serviceUrl:
      defaultZone: http://localhost:8081/eureka/
  instance:
    hostname: localhost
    instanceId: ${spring.application.name}:${server.port}

#Ribbon Activation
ribbon:
  eureka:
    enabled: true

展开
收起
垚tutu 2019-12-12 10:02:14 1147 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载