gessnerfl / fake-smtp-server

A simple SMTP Server for Testing purposes. Emails are stored in an in-memory database and rendered in a Web UI
Apache License 2.0
437 stars 90 forks source link

Changing servlet context path does not work anymore #147

Closed gregor-rieble closed 1 year ago

gregor-rieble commented 1 year ago

Before 2.0.0, you could change the context path by specifying the spring property:

server:
  servlet:
    context-path: /fake-smtp

This would have the effect of reaching the frontend server underneath http://localhost:8080/fake-smtp

With version 2.0.0 the frontend will not load anymore. The scripts seem to always be loaded using an absolute path:

E.g.:

http://localhost:8080/static/js/main.ff156b3d.js is trying to be loaded, but http://localhost:8080/fake-smtp/static/js/main.ff156b3d.js would be the desired outcome

I now setting the context path is not a documented feature, but one that we rely one. Would be nice to support this somehow

Sample docker-compose:

version: "3"
services:
  fake-smtp:
    image: gessnerfl/fake-smtp-server:2.0.0
    ports:
      - "8080:1080"
    environment:
        SERVER_SERVLET_CONTEXT-PATH: /fake-smtp
        SERVER_PORT: 1080
        FAKESMTP_PORT: 1025
gessnerfl commented 1 year ago

Will cross check. This should work as before

gessnerfl commented 1 year ago

@gregor-rieble this issue should be fixed with version 2.0.1. Can you please cross check.

gregor-rieble commented 1 year ago

Thank you for the changes, unfortunately, it did not fix the issue for me :( I have created a PR: https://github.com/gessnerfl/fake-smtp-server/pull/161 Don't know if this is the most elegant solution, though

gessnerfl commented 1 year ago

@gregor-rieble I think your solution is more elegant compared to mine. I merged it and tested it on my machine as well. The fix is included in release 2.0.2

gessnerfl commented 1 year ago

closing the ticket after one month of inactivity and missing response